diff --git a/test_scripts/AppServices/AppServiceActivation/001_mobile_deactivate_success.lua b/test_scripts/AppServices/AppServiceActivation/001_mobile_deactivate_success.lua new file mode 100644 index 0000000000..9dbb31a358 --- /dev/null +++ b/test_scripts/AppServices/AppServiceActivation/001_mobile_deactivate_success.lua @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with PublishAppService +-- 3) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- +-- Steps: + +-- 2) HMI sends AppService.AppServiceActivation activate = false +-- +-- Expected: +-- 1) HMI receives a successful response with activate = false +-- 2) Mobile app and HMI receive OnSystemCapabilityUpdated notification with updateReason = DEACTIVATED +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "AppService.AppServiceActivation", + params = { + activate = false + } +} + +local expectedResponse = { + result = { + activate = false + }, + code = 0, + method = "AppService.AppServiceActivation" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + + local cid = common.getHMIConnection():SendRequest(rpc.name, requestParams) + + EXPECT_HMIRESPONSE(cid, expectedResponse):Times(1) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(AtLeast(1)) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(AtLeast(1)) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/AppServiceActivation/002_hmi_deactivate_success.lua b/test_scripts/AppServices/AppServiceActivation/002_hmi_deactivate_success.lua new file mode 100644 index 0000000000..9c82190c9d --- /dev/null +++ b/test_scripts/AppServices/AppServiceActivation/002_hmi_deactivate_success.lua @@ -0,0 +1,85 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with GetSystemCapability +-- 3) Application 1 sends a GetSystemCapability RPC request with subscribe = true +-- 4) HMI sends a PublishAppService RPC request with serviceType MEDIA +-- +-- Steps: + +-- 1) HMI sends AppService.AppServiceActivation activate = false +-- +-- Expected: +-- 1) HMI receives a successful response with activate = false +-- 2) Mobile app and HMI receive OnSystemCapabilityUpdated notification with updateReason = DEACTIVATED +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "AppService.AppServiceActivation", + params = { + activate = false + } +} + +local expectedResponse = { + result = { + activate = false + }, + code = 0, + method = "AppService.AppServiceActivation" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local service_id = common.getAppServiceID(0) + local requestParams = rpc.params + requestParams.serviceID = service_id + + local cid = common.getHMIConnection():SendRequest(rpc.name, requestParams) + + EXPECT_HMIRESPONSE(cid, expectedResponse):Times(1) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(AtLeast(1)) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(AtLeast(1)) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) +runner.Step("GetSystemCapability and subscribe", common.GetAppServiceSystemCapability, { manifest, true, 1}) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/AppServiceActivation/003_two_apps_activate_success.lua b/test_scripts/AppServices/AppServiceActivation/003_two_apps_activate_success.lua new file mode 100644 index 0000000000..293f8e1d56 --- /dev/null +++ b/test_scripts/AppServices/AppServiceActivation/003_two_apps_activate_success.lua @@ -0,0 +1,101 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions for App 1 are assigned for with PublishAppService +-- 4) AppServiceProvider permissions for App 2 are assigned for with PublishAppService +-- 5) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 6) Application 2 sends a PublishAppService RPC request with serviceType MEDIA +-- +-- Steps: +-- 1) HMI sends AppService.AppServiceActivation activate = true and App 2's serviceID +-- +-- Expected: +-- 1) HMI receives a successful response with activate = true +-- 2) Both mobile apps and the HMI receieve an OnSystemCapabilityUpdated notification. App 1 is DEACTIVATED. App 2 is ACTIVATED. +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local manifest2 = { + serviceName = config.application2.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application2.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "AppService.AppServiceActivation", + params = { + activate = true + } +} + +local expectedResponse = { + result = { + activate = true + }, + code = 0, + method = "AppService.AppServiceActivation" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceProducerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID(2) + local requestParams = rpc.params + requestParams.serviceID = service_id + + local cid = common.getHMIConnection():SendRequest(rpc.name, requestParams) + + EXPECT_HMIRESPONSE(cid, expectedResponse):Times(1) + + local onSystemCapabilityParams1 = common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest) + local onSystemCapabilityParams2 = common.appServiceCapabilityUpdateParams("ACTIVATED", manifest2) + + local combinedParams = onSystemCapabilityParams1 + combinedParams.systemCapability.appServicesCapabilities.appServices[2] = onSystemCapabilityParams2.systemCapability.appServicesCapabilities.appServices[1] + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", combinedParams):Times(AtLeast(1)) + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", combinedParams):Times(AtLeast(1)) + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", combinedParams):Times(AtLeast(1)) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Publish App Service 2", common.publishSecondMobileAppService, { manifest, manifest2, 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/AppServiceActivation/004_two_apps_default_disconnect_reconnect.lua b/test_scripts/AppServices/AppServiceActivation/004_two_apps_default_disconnect_reconnect.lua new file mode 100644 index 0000000000..40e430d331 --- /dev/null +++ b/test_scripts/AppServices/AppServiceActivation/004_two_apps_default_disconnect_reconnect.lua @@ -0,0 +1,169 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions for App 1 are assigned for with PublishAppService +-- 4) AppServiceProvider permissions for App 2 are assigned for with PublishAppService +-- 5) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 6) Application 2 sends a PublishAppService RPC request with serviceType MEDIA +-- +-- Steps: +-- 1) HMI sends AppService.AppServiceActivation activate = true, App 2's serviceID, setAsDefault = true +-- 2) Disconnect App 2 +-- 3) Stop Core +-- 4) Follow preconditions +-- +-- Expected: +-- 1) HMI receives a successful response with activate = true, setAsDefault = true +-- 2) Both mobile apps and the HMI receieve an OnSystemCapabilityUpdated notification. App 1 is DEACTIVATED. App 2 is ACTIVATED. +-- 3) OnDisconnect expect App1 and HMI to receive OnSystemCapabilityUpdated App 2 updateReason REMOVED. App1 record is unchanged. +-- 4) PublishAppService for App 2 after restart, expect OnSystemCapabilityUpdated PUBLISHED for App 2 +-- 5) PublishAppService for App 2 after restart, expect OnSystemCapabilityUpdated ACTIVATED for App 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local manifest2 = { + serviceName = config.application2.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application2.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "AppService.AppServiceActivation", + params = { + activate = true, + setAsDefault = true + } +} + +local expectedResponse = { + result = { + activate = true, + setAsDefault = true + }, + code = 0, + method = "AppService.AppServiceActivation" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceProducerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID(2) + local requestParams = rpc.params + requestParams.serviceID = service_id + + local cid = common.getHMIConnection():SendRequest(rpc.name, requestParams) + + EXPECT_HMIRESPONSE(cid, expectedResponse):Times(1) + + local onSystemCapabilityParams1 = common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest) + local onSystemCapabilityParams2 = common.appServiceCapabilityUpdateParams("ACTIVATED", manifest2) + + local combinedParams = onSystemCapabilityParams1 + combinedParams.systemCapability.appServicesCapabilities.appServices[2] = onSystemCapabilityParams2.systemCapability.appServicesCapabilities.appServices[1] + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", combinedParams):Times(AtLeast(1)) + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", combinedParams):Times(AtLeast(1)) + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", combinedParams):Times(AtLeast(1)) +end + +local function disconnectDefaultService(self) + local mobileSession = common.getMobileSession(2) + local cid = mobileSession:SendRPC("UnregisterAppInterface", {}) + mobileSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + + local onSystemCapabilityParams1 = common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest) + local onSystemCapabilityParams2 = common.appServiceCapabilityUpdateParams("REMOVED", manifest2) + + local combinedParams = onSystemCapabilityParams1 + combinedParams.systemCapability.appServicesCapabilities.appServices[2] = onSystemCapabilityParams2.systemCapability.appServicesCapabilities.appServices[1] + combinedParams.systemCapability.appServicesCapabilities.appServices[1].updateReason = nil + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", combinedParams):Times(1) + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", combinedParams):Times(1) + +end + +local function republishDefaultApp(self) + local mobileSession = common.getMobileSession(2) + local cid = mobileSession:SendRPC("PublishAppService", { + appServiceManifest = manifest2 + }) + local onSystemCapabilityParams = common.appServiceCapabilityUpdateParams("ACTIVATED", manifest) + local onSystemCapabilityParams1 = common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest) + + local onSystemCapabilityParams2 = common.appServiceCapabilityUpdateParams("PUBLISHED", manifest2) + local onSystemCapabilityParams3 = common.appServiceCapabilityUpdateParams("ACTIVATED", manifest2) + + local publishedParams = onSystemCapabilityParams + publishedParams.systemCapability.appServicesCapabilities.appServices[2] = onSystemCapabilityParams2.systemCapability.appServicesCapabilities.appServices[1] + publishedParams.systemCapability.appServicesCapabilities.appServices[1].updateReason = nil + + local activatedParams = onSystemCapabilityParams1 + activatedParams.systemCapability.appServicesCapabilities.appServices[2] = onSystemCapabilityParams3.systemCapability.appServicesCapabilities.appServices[1] + activatedParams.systemCapability.appServicesCapabilities.appServices[1].updateReason = nil + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", publishedParams, activatedParams):Times((2)) + + mobileSession:ExpectResponse(cid, { + appServiceRecord = { + serviceManifest = manifest2, + servicePublished = true + }, + success = true, + resultCode = "SUCCESS" + }):Times(1) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Publish App Service 2", common.publishSecondMobileAppService, { manifest, manifest2, 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) +runner.Step("Disconnect Default Service App", disconnectDefaultService) +runner.Step("Clean sessions", common.cleanSession, {1}) +runner.Step("Clean sessions", common.cleanSession, {2}) +runner.Step("Stop SDL", common.postconditions) +runner.Step("Clean environment", commonFunctions.SDLForceStop) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 1 }) +runner.Step("Activate App", common.activateApp) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Reconnect Default Service App", republishDefaultApp) + + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetAppServiceData/001_M2M_success_flow.lua b/test_scripts/AppServices/GetAppServiceData/001_M2M_success_flow.lua new file mode 100644 index 0000000000..6dbb4bbfbf --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/001_M2M_success_flow.lua @@ -0,0 +1,98 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end) + + mobileSession2:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetAppServiceData/002_M2H_success_flow.lua b/test_scripts/AppServices/GetAppServiceData/002_M2H_success_flow.lua new file mode 100644 index 0000000000..7150b7eb3d --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/002_M2H_success_flow.lua @@ -0,0 +1,98 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to the HMI as AppService.GetAppServiceData +-- 2) HMI sends a AppService.GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application as GetAppServiceData +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local appServiceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = appServiceData, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID(0) + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + EXPECT_HMICALL(rpc.hmiName, rpc.params):Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { + serviceData = appServiceData + }) + end) + + mobileSession:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/003_H2M_success_flow.lua b/test_scripts/AppServices/GetAppServiceData/003_H2M_success_flow.lua new file mode 100644 index 0000000000..f888b87eca --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/003_H2M_success_flow.lua @@ -0,0 +1,101 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) Application has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application as GetAppServiceData +-- 2) Application sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to HMI as AppService.GetAppServiceData +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local appServiceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = appServiceData, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end) + + EXPECT_HMIRESPONSE(cid, { + result = { + serviceData = appServiceData, + code = 0, + method = rpc.hmiName + } + }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/004_M2M_unknown_param_success.lua b/test_scripts/AppServices/GetAppServiceData/004_M2M_unknown_param_success.lua new file mode 100644 index 0000000000..085482c0e1 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/004_M2M_unknown_param_success.lua @@ -0,0 +1,103 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- 4) AppServiceConsumer permissions are assigned for with GetAppServiceData +-- +-- Steps: +-- 1) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 2) Application 2 sends a GetAppServiceData RPC request with serviceType MEDIA and an unknown serviceData parameter +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = { + futureServiceManifestItem = "This a future manifest parameter" + } +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType, + futureServiceRequestItem = "This is a future request parameter" + } +} + +local expectedResponse = { + serviceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20, + unknownFutureParam = 50 + } + }, + success = true, + resultCode = "SUCCESS" +} + +--[[ Local Functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end) + + mobileSession2:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Set config.ValidateSchema = false", common.setValidateSchema, {false}) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetAppServiceData/005_M2M_Nav_success_flow.lua b/test_scripts/AppServices/GetAppServiceData/005_M2M_Nav_success_flow.lua new file mode 100644 index 0000000000..c2a38e1623 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/005_M2M_Nav_success_flow.lua @@ -0,0 +1,104 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a NAVIGATION service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType NAVIGATION +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = { + acceptsWayPoints = true + } +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = { + serviceType = manifest.serviceType, + navigationServiceData = { + timeStamp = { + hour = 2, + minute = 14, + second = 46 + }, + origin = { + locationName = "origin" + }, + destination = { + locationName = "destination" + }, + destinationETA = { + hour = 2, + minute = 18, + second = 50 + }, + prompt = "Navigating to destination" + } + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, manifest.serviceType); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end) + + mobileSession2:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/006_M2M_Weather_success_flow.lua b/test_scripts/AppServices/GetAppServiceData/006_M2M_Weather_success_flow.lua new file mode 100644 index 0000000000..3d68c5211e --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/006_M2M_Weather_success_flow.lua @@ -0,0 +1,106 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a WEATHER service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType WEATHER +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "WEATHER", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + weatherServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = { + serviceType = manifest.serviceType, + weatherServiceData = { + location = { + locationName = "location" + }, + currentForecast = { + currentTemperature = { + unit = "CELSIUS", + value = -4.6 + }, + weatherSummary = "Cold", + humidity = 0.25, + cloudCover = 0.5, + moonPhase = 0.75, + windBearing = 180, + windGust = 2.0, + windSpeed = 5.0 + }, + alerts = { + { + title = "Weather Alert" + } + } + } + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, manifest.serviceType); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end) + + mobileSession2:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/007_M2M_Future_service_type_success_flow.lua b/test_scripts/AppServices/GetAppServiceData/007_M2M_Future_service_type_success_flow.lua new file mode 100644 index 0000000000..5b7cf9ef99 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/007_M2M_Future_service_type_success_flow.lua @@ -0,0 +1,91 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a FUTURE service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType FUTURE +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.ValidateSchema = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "FUTURE", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + weatherServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = { + serviceType = manifest.serviceType, + futureServiceData = { + futureParam1 = "Value", + futureParam2 = 4, + futureParam3 = { + futureParam4 = 7.8 + } + } + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, manifest.serviceType); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end) + + mobileSession2:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/008_M2M_Timeout.lua b/test_scripts/AppServices/GetAppServiceData/008_M2M_Timeout.lua new file mode 100644 index 0000000000..a011d317f5 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/008_M2M_Timeout.lua @@ -0,0 +1,100 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + RUN_AFTER((function() + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end), runner.testSettings.defaultTimeout + 2000) + end) + + mobileSession2:ExpectResponse(cid, responseParams):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetAppServiceData/009_M2H_Timeout.lua b/test_scripts/AppServices/GetAppServiceData/009_M2H_Timeout.lua new file mode 100644 index 0000000000..b2250bd22d --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/009_M2H_Timeout.lua @@ -0,0 +1,101 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to the HMI as AppService.GetAppServiceData +-- 2) HMI sends a AppService.GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application as GetAppServiceData +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local appServiceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = appServiceData, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID(0) + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + EXPECT_HMICALL(rpc.hmiName, rpc.params):Do(function(_, data) + RUN_AFTER((function() + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { + serviceData = appServiceData + }) + end), runner.testSettings.defaultTimeout + 2000) + end) + + + mobileSession:ExpectResponse(cid, responseParams):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/010_H2M_Timeout.lua b/test_scripts/AppServices/GetAppServiceData/010_H2M_Timeout.lua new file mode 100644 index 0000000000..962a8f8eb7 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/010_H2M_Timeout.lua @@ -0,0 +1,103 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) Application has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application as GetAppServiceData +-- 2) Application sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to HMI as AppService.GetAppServiceData +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local appServiceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + serviceData = appServiceData, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, rpc.params) + local service_id = common.getAppServiceID() + local responseParams = expectedResponse + responseParams.serviceData.serviceID = service_id + mobileSession:ExpectRequest(rpc.name, rpc.params):Do(function(_, data) + RUN_AFTER((function() + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, responseParams) + end), runner.testSettings.defaultTimeout + 2000) + end) + + EXPECT_HMIRESPONSE(cid, { + result = { + serviceData = appServiceData, + code = 0, + method = rpc.hmiName + } + }):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/011_M2M_GENERIC_ERROR.lua b/test_scripts/AppServices/GetAppServiceData/011_M2M_GENERIC_ERROR.lua new file mode 100644 index 0000000000..1cccb70805 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/011_M2M_GENERIC_ERROR.lua @@ -0,0 +1,79 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 does not respond to SDL +-- 3) SDL sends a GENERIC_ERROR response to Application 2 when the request times out +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + success = false, + resultCode = "GENERIC_ERROR" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID() + -- Do not respond to request + mobileSession:ExpectRequest(rpc.name, rpc.params) + + mobileSession2:ExpectResponse(cid, expectedResponse) + :Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI() + 1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_GENERIC_ERROR", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetAppServiceData/012_M2H_GENERIC_ERROR.lua b/test_scripts/AppServices/GetAppServiceData/012_M2H_GENERIC_ERROR.lua new file mode 100644 index 0000000000..4aa3505fac --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/012_M2H_GENERIC_ERROR.lua @@ -0,0 +1,74 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to the HMI as AppService.GetAppServiceData +-- 2) HMI does not respond to SDL +-- 3) SDL sends a GENERIC_ERROR response to the Application when the request times out +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + success = false, + resultCode = "GENERIC_ERROR" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + local service_id = common.getAppServiceID(0) + -- Do not respond to request + EXPECT_HMICALL(rpc.hmiName, rpc.params) + + mobileSession:ExpectResponse(cid, expectedResponse) + :Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI() + 1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_GENERIC_ERROR", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/013_H2M_GENERIC_ERROR.lua b/test_scripts/AppServices/GetAppServiceData/013_H2M_GENERIC_ERROR.lua new file mode 100644 index 0000000000..4ae72699f8 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/013_H2M_GENERIC_ERROR.lua @@ -0,0 +1,77 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) Application has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application as GetAppServiceData +-- 2) Application does not respond to SDL +-- 3) SDL sends a GENERIC_ERROR response to the HMI when the request times out +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = manifest.serviceType + } +} + +local expectedResponse = { + code = 22, --GENERIC_ERROR + data = { + method = rpc.hmiName + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, rpc.params) + local service_id = common.getAppServiceID() + -- Do not respond to request + mobileSession:ExpectRequest(rpc.name, rpc.params) + + EXPECT_HMIRESPONSE(cid, { + error = expectedResponse + }):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI() + 1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_GENERIC_ERROR", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/014_M2M_Unknown_ServiceType.lua b/test_scripts/AppServices/GetAppServiceData/014_M2M_Unknown_ServiceType.lua new file mode 100644 index 0000000000..c316bd84b4 --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/014_M2M_Unknown_ServiceType.lua @@ -0,0 +1,77 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with GetAppServiceData +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a GetAppServiceData RPC request with serviceType MUSIC +-- +-- Expected: +-- 1) SDL responds to Application 2 with {success = false, resultCode = "DATA_NOT_AVAILABLE"} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + params = { + serviceType = "MUSIC" + } +} + +local expectedResponse = { + serviceData = nil, + success = false, + resultCode = "DATA_NOT_AVAILABLE" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + + -- Request is NOT forwarded to ASP + mobileSession:ExpectRequest(rpc.name, rpc.params):Times(0) + + mobileSession2:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_DATA_NOT_AVAILABLE", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetAppServiceData/015_M2H_Unknown_ServiceType.lua b/test_scripts/AppServices/GetAppServiceData/015_M2H_Unknown_ServiceType.lua new file mode 100644 index 0000000000..a84428d43a --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/015_M2H_Unknown_ServiceType.lua @@ -0,0 +1,72 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a GetAppServiceData RPC request with serviceType MUSIC +-- +-- Expected: +-- 1) SDL responds to the Application with {success = false, resultCode = "DATA_NOT_AVAILABLE"} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = "MUSIC" + } +} + +local expectedResponse = { + serviceData = nil, + success = false, + resultCode = "DATA_NOT_AVAILABLE" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + -- Request is NOT forwarded to ASP + EXPECT_HMICALL(rpc.hmiName, rpc.params):Times(0) + + mobileSession:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_DATA_NOT_AVAILABLE", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceData/016_H2M_Unknown_ServiceType.lua b/test_scripts/AppServices/GetAppServiceData/016_H2M_Unknown_ServiceType.lua new file mode 100644 index 0000000000..bdd37dfe7e --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceData/016_H2M_Unknown_ServiceType.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetAppServiceData +-- 3) Application has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.GetAppServiceData RPC request with serviceType MUSIC +-- +-- Expected: +-- 1) SDL responds to the HMI with {code = "DATA_NOT_AVAILABLE"} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetAppServiceData", + hmiName = "AppService.GetAppServiceData", + params = { + serviceType = "MUSIC" + } +} + +local expectedResponse = { + serviceData = nil, + success = false, + resultCode = "DATA_NOT_AVAILABLE" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, rpc.params) + + -- Request is NOT forwarded to ASP + mobileSession:ExpectRequest(rpc.name, rpc.params):Times(0) + + EXPECT_HMIRESPONSE(cid, { + error = { + serviceData = nil, + code = 9, --DATA_NOT_AVAILABLE (HMI_API) + data = { + method = rpc.hmiName + } + } + }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_DATA_NOT_AVAILABLE", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceRecords/001_GetAppServiceRecords_MOBILE.lua b/test_scripts/AppServices/GetAppServiceRecords/001_GetAppServiceRecords_MOBILE.lua new file mode 100644 index 0000000000..0e167ffe5d --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceRecords/001_GetAppServiceRecords_MOBILE.lua @@ -0,0 +1,75 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 is Registered +-- 2) AppServiceProvider permissions are assigned for +-- +-- Steps: +-- 1) app1 sends a PublishAppService (with {serviceType="MEDIA", handledRPC=ButtonPress}) +-- 2) HMI sends a GetAppServiceRecords to Core +-- +-- Expected: +-- 1) Core returns the service record of the MEDIA service published by app1 ({servicePublished=true, serviceActive=true}) +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + handledRPCs = { 41 }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local function getExpectedResponse() + local response = { + code = 0, + method = "AppService.GetAppServiceRecords", + serviceRecords = { + { + servicePublished = true, + serviceActive = true, + serviceID = common.getAppServiceID(1), + serviceManifest = manifest + } + } + } + return response +end + +--[[ Local functions ]] +local function PTUfunc(tbl) + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 41}} + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry +end + +local function getAppServiceRecords(service_type) + expectedResponse = getExpectedResponse() + table.sort(expectedResponse.serviceRecords, function(r1, r2) return r1.serviceID < r2.serviceID end) + local rid = common.getHMIConnection():SendRequest(expectedResponse.method, { + serviceType = service_type + }) + EXPECT_HMIRESPONSE(rid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("GetAppServiceRecords_MOBILE") +runner.Step("Publish Mobile AppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("GetAppServiceRecords", getAppServiceRecords, { "MEDIA" }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/GetAppServiceRecords/002_GetAppServiceRecords_HMI.lua b/test_scripts/AppServices/GetAppServiceRecords/002_GetAppServiceRecords_HMI.lua new file mode 100644 index 0000000000..92336805eb --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceRecords/002_GetAppServiceRecords_HMI.lua @@ -0,0 +1,64 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- +-- Steps: +-- 1) HMI sends a PublishAppService (with {serviceType="MEDIA", handledRPC=ButtonPress}) +-- 2) HMI sends a GetAppServiceRecords to Core +-- +-- Expected: +-- 1) Core returns the service record of the MEDIA service published by the HMI ({servicePublished=true, serviceActive=true}) +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = "HMI MEDIA", + serviceType = "MEDIA", + handledRPCs = { 41 }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local function getExpectedResponse() + local response = { + code = 0, + method = "AppService.GetAppServiceRecords", + serviceRecords = { + { + servicePublished = true, + serviceActive = true, + serviceID = common.getAppServiceID(0), + serviceManifest = manifest + } + } + } + return response +end + +--[[ Local functions ]] +local function getAppServiceRecords(service_type) + expectedResponse = getExpectedResponse() + table.sort(expectedResponse.serviceRecords, function(r1, r2) return r1.serviceID < r2.serviceID end) + local rid = common.getHMIConnection():SendRequest(expectedResponse.method, { + serviceType = service_type + }) + EXPECT_HMIRESPONSE(rid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("GetAppServiceRecords_EMBEDDED") +runner.Step("Publish Embedded AppService", common.publishEmbeddedAppService, { manifest }) +runner.Step("GetAppServiceRecords", getAppServiceRecords, { "MEDIA" }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) \ No newline at end of file diff --git a/test_scripts/AppServices/GetAppServiceRecords/003_GetAppServiceRecords_Multiple.lua b/test_scripts/AppServices/GetAppServiceRecords/003_GetAppServiceRecords_Multiple.lua new file mode 100644 index 0000000000..a55d485aaa --- /dev/null +++ b/test_scripts/AppServices/GetAppServiceRecords/003_GetAppServiceRecords_Multiple.lua @@ -0,0 +1,93 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 is Registered +-- 2) AppServiceProvider permissions are assigned for +-- +-- Steps: +-- 1) app1 sends a PublishAppService (with {serviceType="MEDIA", handledRPC=ButtonPress}) +-- 2) HMI sends a PublishAppService (with {serviceType="MEDIA", handledRPC=ButtonPress}) +-- 3) HMI sends a GetAppServiceRecords to Core +-- +-- Expected: +-- 1) Core returns the service records of the MEDIA services published by app1 ({servicePublished=true, serviceActive=false}) +-- and by the HMI ({servicePublished=true, serviceActive=true}) +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + handledRPCs = { 41 }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local hmi_manifest = { + serviceName = "HMI MEDIA", + serviceType = "MEDIA", + handledRPCs = { 41 }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local function getExpectedResponse() + local response = { + code = 0, + method = "AppService.GetAppServiceRecords", + serviceRecords = { + { + servicePublished = true, + serviceActive = false, + serviceID = common.getAppServiceID(1), + serviceManifest = manifest + }, + { + servicePublished = true, + serviceActive = true, + serviceID = common.getAppServiceID(0), + serviceManifest = hmi_manifest + } + } + } + return response +end + +--[[ Local functions ]] +local function PTUfunc(tbl) + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 41}} + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry +end + +local function getAppServiceRecords(service_type) + expectedResponse = getExpectedResponse() + table.sort(expectedResponse.serviceRecords, function(r1, r2) return r1.serviceID < r2.serviceID end) + local rid = common.getHMIConnection():SendRequest(expectedResponse.method, { + serviceType = service_type + }) + EXPECT_HMIRESPONSE(rid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("GetAppServiceRecords_MULTIPLE") +runner.Step("Publish Mobile AppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("Publish Embedded AppService", common.publishEmbeddedAppService, { hmi_manifest }) +runner.Step("GetAppServiceRecords", getAppServiceRecords, { "MEDIA" }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) \ No newline at end of file diff --git a/test_scripts/AppServices/GetFile/001_GetFile_Success.lua b/test_scripts/AppServices/GetFile/001_GetFile_Success.lua new file mode 100644 index 0000000000..a29feef23b --- /dev/null +++ b/test_scripts/AppServices/GetFile/001_GetFile_Success.lua @@ -0,0 +1,51 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceConsumer permissions are assigned for +-- 3) Application sends a PutFile Request with a given file name +-- +-- Steps: +-- 1) Application sends a GetFile Request with the same file name +-- +-- Expected: +-- 1) GetFile will return SUCCESS +-- 2) The CRC value returned in the GetFile response will be the same as the crc32 hash of the file binary data +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local variables ]] +local putFileParams = { + syncFileName = "icon.png", + fileType ="GRAPHIC_PNG", +} +local getFileParams = { + fileName = "icon.png", + fileType = "GRAPHIC_PNG", +} +local result = { success = true, resultCode = "SUCCESS"} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Putfile", common.putFileInStorage, {1, putFileParams, result}) + +runner.Title("Test") +runner.Step("Getfile", common.getFileFromStorage, {1, getFileParams, result}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetFile/002_GetFile_FileNotFound.lua b/test_scripts/AppServices/GetFile/002_GetFile_FileNotFound.lua new file mode 100644 index 0000000000..9be9df1c6f --- /dev/null +++ b/test_scripts/AppServices/GetFile/002_GetFile_FileNotFound.lua @@ -0,0 +1,45 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceConsumer permissions are assigned for +-- +-- Steps: +-- 1) Application sends a GetFile Request with file name which should not be in the storage folder +-- +-- Expected: +-- 1) GetFile will return FILE_NOT_FOUND +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local variables ]] + +local getFileParams = { + fileName = "icon.png", + fileType = "GRAPHIC_PNG", +} +local result = { success = false, resultCode = "FILE_NOT_FOUND"} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Getfile", common.getFileFromStorage, {1, getFileParams, result}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetFile/003_GetFile_Mobile_ASP.lua b/test_scripts/AppServices/GetFile/003_GetFile_Mobile_ASP.lua new file mode 100644 index 0000000000..71cbc51161 --- /dev/null +++ b/test_scripts/AppServices/GetFile/003_GetFile_Mobile_ASP.lua @@ -0,0 +1,66 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Applications with and are registered on SDL. +-- 2) AppServiceProvider permissions are assigned for +-- 3) AppServiceConsumer permissions are assigned for +-- 4) Application 1 sends a PutFile Request with a given file name +-- 5) Application 1 sends a PublishAppService +-- +-- Steps: +-- 1) Application 2 sends a GetFile Request with the same file name and the id of the service published by app1 +-- +-- Expected: +-- 1) GetFile will return SUCCESS +-- 2) The CRC value returned in the GetFile response will be the same as the crc32 hash of the file binary data +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local putFileParams = { + syncFileName = "icon.png", + fileType ="GRAPHIC_PNG", +} + +local getFileParams = { + fileName = "icon.png", + fileType = "GRAPHIC_PNG", +} + +local result = { success = true, resultCode = "SUCCESS"} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Putfile", common.putFileInStorage, {1, putFileParams, result}) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("Getfile", common.getFileFromService, {2, 1, getFileParams, result}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetFile/004_GetFile_HMI_ASP.lua b/test_scripts/AppServices/GetFile/004_GetFile_HMI_ASP.lua new file mode 100644 index 0000000000..e88f58ab6f --- /dev/null +++ b/test_scripts/AppServices/GetFile/004_GetFile_HMI_ASP.lua @@ -0,0 +1,61 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceConsumer permissions are assigned for +-- 3) HMI sends a PublishAppService +-- +-- Steps: +-- 1) Application sends a GetFile Request with the id of the service published by the HMI +-- +-- Expected: +-- 1) GetFile will return SUCCESS +-- 2) The CRC value returned in the GetFile response will be the same as the crc32 hash of the file binary data +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local putFileParams = { + syncFileName = "icon.png", + fileType ="GRAPHIC_PNG", +} + +local getFileParams = { + fileName = "icon.png", + fileType = "GRAPHIC_PNG", +} + +local result = { success = true, resultCode = "SUCCESS"} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("PublishAppService", common.publishEmbeddedAppService, { manifest }) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Getfile", common.getFileFromService, {1, 0, getFileParams, result}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/GetFile/005_GetFile_Timeout_HMI_ASP.lua b/test_scripts/AppServices/GetFile/005_GetFile_Timeout_HMI_ASP.lua new file mode 100644 index 0000000000..7ab24c0d20 --- /dev/null +++ b/test_scripts/AppServices/GetFile/005_GetFile_Timeout_HMI_ASP.lua @@ -0,0 +1,88 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceConsumer permissions are assigned for +-- 3) HMI sends a PublishAppService +-- +-- Steps: +-- 1) Application sends a GetFile Request with the id of the service published by the HMI +-- +-- Expected: +-- 1) GetFile will return SUCCESS +-- 2) The CRC value returned in the GetFile response will be the same as the crc32 hash of the file binary data +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local putFileParams = { + syncFileName = "icon.png", + fileType ="GRAPHIC_PNG", +} + +local getFileParams = { + fileName = "icon.png", + fileType = "GRAPHIC_PNG", +} + +local result = { success = true, resultCode = "SUCCESS"} + + +--[[ Local functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +local function getATFPath() + local handle = io.popen("echo $(pwd)") + local result = handle:read("*a") + handle:close() + return result:sub(0, -2) +end + +local function getFileFromService(app_id, asp_app_id, request_params, response_params) + local mobileSession = common.getMobileSession(app_id) + request_params.appServiceId = common.getAppServiceID(asp_app_id) + --mobile side: sending GetFile request + local cid = mobileSession:SendRPC("GetFile", request_params) + if asp_app_id == 0 then + --EXPECT_HMICALL + common.getHMIConnection():ExpectRequest("BasicCommunication.GetFilePath") + :Do(function(_, d2) + local cwd = getATFPath() + file_path = cwd.."/files/"..request_params.fileName + RUN_AFTER((function() + common.getHMIConnection():SendResponse(d2.id, d2.method, "SUCCESS", {filePath = file_path}) + end), runner.testSettings.defaultTimeout + 2000) + end) + end + --mobile side: expected GetFile response + mobileSession:ExpectResponse(cid, response_params):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("PublishAppService", common.publishEmbeddedAppService, { manifest }) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Getfile", getFileFromService, {1, 0, getFileParams, result}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) \ No newline at end of file diff --git a/test_scripts/AppServices/OnAppServiceData/001_M2M_success_flow.lua b/test_scripts/AppServices/OnAppServiceData/001_M2M_success_flow.lua new file mode 100644 index 0000000000..d31b9c1819 --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/001_M2M_success_flow.lua @@ -0,0 +1,90 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with OnAppServiceData +-- 5) Application 1 has published a MEDIA service +-- 6) Application 2 is subscribed to MEDIA app service data +-- +-- Steps: +-- 2) Application 1 sends a OnAppServiceData RPC notification with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the OnAppServiceData notification to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "OnAppServiceData" +} + +local expectedNotification = { + serviceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + mobileSession:SendNotification(rpc.name, notificationParams) + mobileSession2:ExpectNotification(rpc.name, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Subscribe App Service Data", common.mobileSubscribeAppServiceData, { 1, manifest.serviceType, 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/OnAppServiceData/002_M2H_success_flow.lua b/test_scripts/AppServices/OnAppServiceData/002_M2H_success_flow.lua new file mode 100644 index 0000000000..e6c1e28ddc --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/002_M2H_success_flow.lua @@ -0,0 +1,87 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with OnAppServiceData +-- 3) HMI has published a MEDIA service +-- 4) Application is subscribed to MEDIA app service data +-- +-- Steps: +-- 1) HMI sends a OnAppServiceData RPC notification with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the OnAppServiceData notification to Application +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local appServiceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } +} + +local rpc = { + name = "OnAppServiceData", + hmiName = "AppService.OnAppServiceData" +} + +local expectedNotification = { + serviceData = appServiceData +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID(0) + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + common.getHMIConnection():SendNotification(rpc.hmiName, notificationParams) + mobileSession:ExpectNotification(rpc.name, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) +runner.Step("Subscribe App Service Data", common.mobileSubscribeAppServiceData, { 0 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/OnAppServiceData/003_H2M_success_flow.lua b/test_scripts/AppServices/OnAppServiceData/003_H2M_success_flow.lua new file mode 100644 index 0000000000..6e6d4cb485 --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/003_H2M_success_flow.lua @@ -0,0 +1,86 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with OnAppServiceData +-- 3) Application has published a MEDIA service +-- 4) HMI is subscribed to OnAppServiceData +-- +-- Steps: +-- 1) Application sends a OnAppServiceData RPC notification with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the OnAppServiceData notification to HMI +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local appServiceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20 + } +} + +local rpc = { + name = "OnAppServiceData", + hmiName = "AppService.OnAppServiceData" +} + +local expectedNotification = { + serviceData = appServiceData +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID(1) + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + mobileSession:SendNotification(rpc.name, notificationParams) + EXPECT_HMINOTIFICATION(rpc.hmiName, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/OnAppServiceData/004_OnAppServiceData_unknown_param_success.lua b/test_scripts/AppServices/OnAppServiceData/004_OnAppServiceData_unknown_param_success.lua new file mode 100644 index 0000000000..3bbf4c7742 --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/004_OnAppServiceData_unknown_param_success.lua @@ -0,0 +1,95 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- 4) AppServiceConsumer permissions are assigned for with GetAppServiceData +-- +-- Steps: +-- 1) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 2) Application 2 sends a GetAppServiceData RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) SDL forwards the GetAppServiceData request to Application 1 +-- 2) Application 1 sends a GetAppServiceData response (SUCCESS) to Core with its own serviceData +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "OnAppServiceData" +} + +local expectedNotification = { + serviceData = { + serviceType = manifest.serviceType, + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Good music", + isExplicit = false, + trackPlaybackProgress = 200, + trackPlaybackDuration = 300, + queuePlaybackProgress = 2200, + queuePlaybackDuration = 4000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 20, + futureMediaData = "Future media data" + }, + futureNotificationStruct = { + futureStructItem = "Future struct item" + } + } +} + + --[[ Local Functions ]] + local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + mobileSession:SendNotification(rpc.name, notificationParams) + mobileSession2:ExpectNotification(rpc.name, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Subscribe App Service Data", common.mobileSubscribeAppServiceData, { 1, "MEDIA", 2 }) +runner.Step("Set config.ValidateSchema = false", common.setValidateSchema, {false}) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/OnAppServiceData/005_M2M_Nav_success_flow.lua b/test_scripts/AppServices/OnAppServiceData/005_M2M_Nav_success_flow.lua new file mode 100644 index 0000000000..73b6c20d6b --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/005_M2M_Nav_success_flow.lua @@ -0,0 +1,95 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with OnAppServiceData +-- 5) Application 1 has published a NAVIGATION service +-- 6) Application 2 is subscribed to NAVIGATION app service data +-- +-- Steps: +-- 2) Application 1 sends a OnAppServiceData RPC notification with serviceType NAVIGATION +-- +-- Expected: +-- 1) SDL forwards the OnAppServiceData notification to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "OnAppServiceData" +} + +local expectedNotification = { + serviceData = { + serviceType = manifest.serviceType, + navigationServiceData = { + timeStamp = { + hour = 2, + minute = 14, + second = 46 + }, + origin = { + locationName = "origin" + }, + destination = { + locationName = "destination" + }, + destinationETA = { + hour = 2, + minute = 18, + second = 50 + }, + prompt = "Navigating to destination" + } + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, manifest.serviceType); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + mobileSession:SendNotification(rpc.name, notificationParams) + mobileSession2:ExpectNotification(rpc.name, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Subscribe App Service Data", common.mobileSubscribeAppServiceData, { 1, manifest.serviceType, 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/OnAppServiceData/006_M2M_Weather_success_flow.lua b/test_scripts/AppServices/OnAppServiceData/006_M2M_Weather_success_flow.lua new file mode 100644 index 0000000000..d0a9f5362b --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/006_M2M_Weather_success_flow.lua @@ -0,0 +1,99 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with OnAppServiceData +-- 5) Application 1 has published a WEATHER service +-- 6) Application 2 is subscribed to WEATHER app service data +-- +-- Steps: +-- 2) Application 1 sends a OnAppServiceData RPC notification with serviceType WEATHER +-- +-- Expected: +-- 1) SDL forwards the OnAppServiceData notification to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "WEATHER", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "OnAppServiceData" +} + +local expectedNotification = { + serviceData = { + serviceType = manifest.serviceType, + weatherServiceData = { + location = { + locationName = "location" + }, + currentForecast = { + currentTemperature = { + unit = "CELSIUS", + value = -4.6 + }, + weatherSummary = "Cold", + humidity = 0.25, + cloudCover = 0.5, + moonPhase = 0.75, + windBearing = 180, + windGust = 2.0, + windSpeed = 5.0 + }, + alerts = { + { + title = "Weather Alert" + } + } + } + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, manifest.serviceType); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + mobileSession:SendNotification(rpc.name, notificationParams) + mobileSession2:ExpectNotification(rpc.name, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Subscribe App Service Data", common.mobileSubscribeAppServiceData, { 1, manifest.serviceType, 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/OnAppServiceData/007_M2M_Future_service_type_success_flow.lua b/test_scripts/AppServices/OnAppServiceData/007_M2M_Future_service_type_success_flow.lua new file mode 100644 index 0000000000..fdcf6e1a82 --- /dev/null +++ b/test_scripts/AppServices/OnAppServiceData/007_M2M_Future_service_type_success_flow.lua @@ -0,0 +1,84 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with OnAppServiceData +-- 5) Application 1 has published a FUTURE service +-- 6) Application 2 is subscribed to FUTURE app service data +-- +-- Steps: +-- 2) Application 1 sends a OnAppServiceData RPC notification with serviceType FUTURE +-- +-- Expected: +-- 1) SDL forwards the OnAppServiceData notification to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.ValidateSchema = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "FUTURE", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "OnAppServiceData" +} + +local expectedNotification = { + serviceData = { + serviceType = manifest.serviceType, + futureServiceData = { + futureParam1 = "Value", + futureParam2 = 4, + futureParam3 = { + futureParam4 = 7.8 + } + } + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, manifest.serviceType); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local notificationParams = expectedNotification + notificationParams.serviceData.serviceID = service_id + + mobileSession:SendNotification(rpc.name, notificationParams) + mobileSession2:ExpectNotification(rpc.name, notificationParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Subscribe App Service Data", common.mobileSubscribeAppServiceData, { 1, manifest.serviceType, 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/001_M2M_success_flow.lua b/test_scripts/AppServices/PerformAppServiceInteraction/001_M2M_success_flow.lua new file mode 100644 index 0000000000..277c6b3e03 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/001_M2M_success_flow.lua @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with PerformAppServiceInteraction +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a PerformAppServiceInteraction RPC request with Application 1's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application 1 +-- 2) Application 1 sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application2.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + mobileSession:ExpectRequest(rpc.name, requestParams):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end) + + mobileSession2:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/002_M2H_success_flow.lua b/test_scripts/AppServices/PerformAppServiceInteraction/002_M2H_success_flow.lua new file mode 100644 index 0000000000..ddd4b58874 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/002_M2H_success_flow.lua @@ -0,0 +1,81 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PerformAppServiceInteraction +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a PerformAppServiceInteraction RPC request with HMI's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to the HMI as AppService.PerformAppServiceInteraction +-- 2) HMI sends a AppService.PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to Application as PerformAppServiceInteraction +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + originApp = config.application1.registerAppInterfaceParams.fullAppID, + serviceUri = "hmi:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID(0) + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession:SendRPC(rpc.name, requestParams) + EXPECT_HMICALL(rpc.hmiName, requestParams):Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { + serviceSpecificResult = expectedResponse.serviceSpecificResult + }) + end) + + mobileSession:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/003_H2M_success_flow.lua b/test_scripts/AppServices/PerformAppServiceInteraction/003_H2M_success_flow.lua new file mode 100644 index 0000000000..6526a93ba8 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/003_H2M_success_flow.lua @@ -0,0 +1,89 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PublishAppService +-- 3) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.PerformAppServiceInteraction RPC request with Application's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application as PerformAppServiceInteraction +-- 2) Application sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to HMI as AppService.PerformAppServiceInteraction +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local hmiOriginID = "HMI_ORIGIN_ID" + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, requestParams) + local passedRequestParams = requestParams + -- Core manually sets the originApp parameter when passing an HMI message through + passedRequestParams.originApp = hmiOriginID + mobileSession:ExpectRequest(rpc.name, passedRequestParams):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end) + + EXPECT_HMIRESPONSE(cid, { + result = { + serviceSpecificResult = expectedResponse.serviceSpecificResult, + code = 0, + method = rpc.hmiName + } + }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Set HMI Origin ID", common.setSDLIniParameter, { "HMIOriginID", hmiOriginID }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/004_M2M_unknown_parameter_success.lua b/test_scripts/AppServices/PerformAppServiceInteraction/004_M2M_unknown_parameter_success.lua new file mode 100644 index 0000000000..eea4cba878 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/004_M2M_unknown_parameter_success.lua @@ -0,0 +1,92 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- 4) AppServiceConsumer permissions are assigned for with PerformAppServiceInteraction +-- +-- Steps: +-- 1) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 2) Application 2 sends a PerformAppServiceInteraction RPC request with Application 1's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application 1 +-- 2) Application 1 sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application1.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri", + futureRequestParameter = "futureRequestParameter", + futureRequestStruct = { + futureStructItem = "futureStructItem" + } + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS", + futureRequestParameter = "futureRequestParameter", + futureRequestStruct = { + futureStructItem = "futureStructItem" + } +} + +--[[ Local Functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + mobileSession:ExpectRequest(rpc.name, requestParams):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end) + + mobileSession2:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Set config.ValidateSchema = false", common.setValidateSchema, {false}) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/005_Mobile_requestServiceActive_background_success_flow.lua b/test_scripts/AppServices/PerformAppServiceInteraction/005_Mobile_requestServiceActive_background_success_flow.lua new file mode 100644 index 0000000000..98dab1637a --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/005_Mobile_requestServiceActive_background_success_flow.lua @@ -0,0 +1,112 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with PerformAppServiceInteraction +-- 5) HMI has published a MEDIA service and is the active MEDIA service +-- 6) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a PerformAppServiceInteraction RPC request with Application 1's serviceID +-- and requestServiceActive = true +-- +-- Expected: +-- 1) SDL sends a AppService.GetActiveServiceConsent message to the HMI, HMI responds with activate = true +-- 2) SDL activates Application 1's MEDIA service and broadcasts OnSystemCapabilityUpdated(APP_SERVICES) +-- 3) SDL forwards the PerformAppServiceInteraction request to Application 1 +-- 4) Application 1 sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 5) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local hmiManifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application2.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri", + requestServiceActive = true + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + + EXPECT_HMICALL("AppService.GetActiveServiceConsent", { serviceID = service_id }):Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { + activate = true + }) + end) + local serviceParams = common.appServiceCapability("ACTIVATED", manifest) + mobileSession:ExpectNotification("OnSystemCapabilityUpdated"):ValidIf(function(self, data) + return common.findCapabilityUpdate(serviceParams, data.payload) + end) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated"):ValidIf(function(self, data) + return common.findCapabilityUpdate(serviceParams, data.params) + end) + + requestParams.requestServiceActive = nil + mobileSession:ExpectRequest(rpc.name, requestParams):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end) + + mobileSession2:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Publish Embedded Service", common.publishEmbeddedAppService, { hmiManifest }) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/006_Mobile_requestServiceActive_foreground_success_flow.lua b/test_scripts/AppServices/PerformAppServiceInteraction/006_Mobile_requestServiceActive_foreground_success_flow.lua new file mode 100644 index 0000000000..0ba2b17161 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/006_Mobile_requestServiceActive_foreground_success_flow.lua @@ -0,0 +1,108 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with PerformAppServiceInteraction +-- 5) Application 2 is in the foreground +-- 6) HMI has published a MEDIA service and is the active MEDIA service +-- 7) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a PerformAppServiceInteraction RPC request with Application 1's serviceID +-- and requestServiceActive = true +-- +-- Expected: +-- 1) SDL activates Application 1's MEDIA service and broadcasts OnSystemCapabilityUpdated(APP_SERVICES) +-- 2) SDL forwards the PerformAppServiceInteraction request to Application 1 +-- 3) Application 1 sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 4) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local hmiManifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application2.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri", + requestServiceActive = true + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + + -- Should not prompt user if app is in foreground + EXPECT_HMICALL("AppService.GetActiveServiceConsent", { serviceID = service_id }):Times(0) + local serviceParams = common.appServiceCapability("ACTIVATED", manifest) + mobileSession:ExpectNotification("OnSystemCapabilityUpdated"):ValidIf(function(self, data) + return common.findCapabilityUpdate(serviceParams, data.payload) + end) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated"):ValidIf(function(self, data) + return common.findCapabilityUpdate(serviceParams, data.params) + end) + + requestParams.requestServiceActive = nil + mobileSession:ExpectRequest(rpc.name, requestParams):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end) + + mobileSession2:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) +runner.Step("Publish Embedded Service", common.publishEmbeddedAppService, { hmiManifest }) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/007_HMI_requestServiceActive_success_flow.lua b/test_scripts/AppServices/PerformAppServiceInteraction/007_HMI_requestServiceActive_success_flow.lua new file mode 100644 index 0000000000..16d35201b2 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/007_HMI_requestServiceActive_success_flow.lua @@ -0,0 +1,108 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PerformAppServiceInteraction +-- 3) HMI has published a MEDIA service and is the active MEDIA service +-- 4) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a AppService.PublishAppService RPC request with serviceType MEDIA +-- 2) HMI sends a AppService.PerformAppServiceInteraction RPC request with Application's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application as PerformAppServiceInteraction +-- 2) Application sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to HMI as AppService.PerformAppServiceInteraction +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local hmiManifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local hmiOriginID = "HMI_ORIGIN_ID" + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + serviceUri = "mobile:sample.service.uri", + requestServiceActive = true + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, requestParams) + local serviceParams = common.appServiceCapability("ACTIVATED", manifest) + mobileSession:ExpectNotification("OnSystemCapabilityUpdated"):ValidIf(function(self, data) + return common.findCapabilityUpdate(serviceParams, data.payload) + end) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated"):ValidIf(function(self, data) + return common.findCapabilityUpdate(serviceParams, data.params) + end) + local passedRequestParams = requestParams + -- Core manually sets the originApp parameter when passing an HMI message through + passedRequestParams.originApp = hmiOriginID + passedRequestParams.requestServiceActive = nil + mobileSession:ExpectRequest(rpc.name, passedRequestParams):Do(function(_, data) + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end) + + EXPECT_HMIRESPONSE(cid, { + result = { + serviceSpecificResult = expectedResponse.serviceSpecificResult, + code = 0, + method = rpc.hmiName + } + }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Set HMI Origin ID", common.setSDLIniParameter, { "HMIOriginID", hmiOriginID }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Publish Embedded Service", common.publishEmbeddedAppService, { hmiManifest }) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/008_M2M_Timeout.lua b/test_scripts/AppServices/PerformAppServiceInteraction/008_M2M_Timeout.lua new file mode 100644 index 0000000000..7248f9793f --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/008_M2M_Timeout.lua @@ -0,0 +1,85 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with PerformAppServiceInteraction +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a PerformAppServiceInteraction RPC request with Application 1's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application 1 +-- 2) Application 1 sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to Application 2 +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application2.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + mobileSession:ExpectRequest(rpc.name, requestParams):Do(function(_, data) + RUN_AFTER((function() + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end), runner.testSettings.defaultTimeout + 2000) + end) + + mobileSession2:ExpectResponse(cid, expectedResponse):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/009_M2H_Timeout.lua b/test_scripts/AppServices/PerformAppServiceInteraction/009_M2H_Timeout.lua new file mode 100644 index 0000000000..2a715575f8 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/009_M2H_Timeout.lua @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PerformAppServiceInteraction +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a PerformAppServiceInteraction RPC request with HMI's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to the HMI as AppService.PerformAppServiceInteraction +-- 2) HMI sends a AppService.PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to Application as PerformAppServiceInteraction +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + originApp = config.application1.registerAppInterfaceParams.fullAppID, + serviceUri = "hmi:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID(0) + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession:SendRPC(rpc.name, requestParams) + EXPECT_HMICALL(rpc.hmiName, requestParams):Do(function(_, data) + RUN_AFTER((function() + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { + serviceSpecificResult = expectedResponse.serviceSpecificResult + }) + end), runner.testSettings.defaultTimeout + 2000) + end) + + mobileSession:ExpectResponse(cid, expectedResponse):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/010_H2M_Timeout.lua b/test_scripts/AppServices/PerformAppServiceInteraction/010_H2M_Timeout.lua new file mode 100644 index 0000000000..42033cc8e1 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/010_H2M_Timeout.lua @@ -0,0 +1,91 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PublishAppService +-- 3) Application has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.PerformAppServiceInteraction RPC request with Application's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application as PerformAppServiceInteraction +-- 2) Application sends a PerformAppServiceInteraction response (SUCCESS) to Core with a serviceSpecificResult +-- 3) SDL forwards the response to HMI as AppService.PerformAppServiceInteraction +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local hmiOriginID = "HMI_ORIGIN_ID" + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = "RESULT", + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, requestParams) + local passedRequestParams = requestParams + -- Core manually sets the originApp parameter when passing an HMI message through + passedRequestParams.originApp = hmiOriginID + mobileSession:ExpectRequest(rpc.name, passedRequestParams):Do(function(_, data) + RUN_AFTER((function() + mobileSession:SendResponse(rpc.name, data.rpcCorrelationId, expectedResponse) + end), runner.testSettings.defaultTimeout + 2000) + end) + + EXPECT_HMIRESPONSE(cid, { + result = { + serviceSpecificResult = expectedResponse.serviceSpecificResult, + code = 0, + method = rpc.hmiName + } + }):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI()) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Set HMI Origin ID", common.setSDLIniParameter, { "HMIOriginID", hmiOriginID }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/011_M2M_GENERIC_ERROR.lua b/test_scripts/AppServices/PerformAppServiceInteraction/011_M2M_GENERIC_ERROR.lua new file mode 100644 index 0000000000..55890c074a --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/011_M2M_GENERIC_ERROR.lua @@ -0,0 +1,82 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with PerformAppServiceInteraction +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a PerformAppServiceInteraction RPC request with Application 1's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application 1 +-- 2) Application 1 does not respond to SDL +-- 3) SDL sends a GENERIC_ERROR response to Application 2 when the request times out +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application2.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + success = false, + resultCode = "GENERIC_ERROR" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + -- Do not respond to request + mobileSession:ExpectRequest(rpc.name, requestParams) + + mobileSession2:ExpectResponse(cid, expectedResponse) + :Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI() + 1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_GENERIC_ERROR", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/012_M2H_GENERIC_ERROR.lua b/test_scripts/AppServices/PerformAppServiceInteraction/012_M2H_GENERIC_ERROR.lua new file mode 100644 index 0000000000..1d5f4cbcc4 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/012_M2H_GENERIC_ERROR.lua @@ -0,0 +1,77 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PerformAppServiceInteraction +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a PerformAppServiceInteraction RPC request with HMI's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to the HMI as AppService.PerformAppServiceInteraction +-- 2) HMI does not respond to SDL +-- 3) SDL sends a GENERIC_ERROR response to the Application when the request times out +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + originApp = config.application1.registerAppInterfaceParams.fullAppID, + serviceUri = "hmi:sample.service.uri" + } +} + +local expectedResponse = { + success = false, + resultCode = "GENERIC_ERROR" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID(0) + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = mobileSession:SendRPC(rpc.name, requestParams) + -- Do not respond to request + EXPECT_HMICALL(rpc.hmiName, requestParams) + + mobileSession:ExpectResponse(cid, expectedResponse) + :Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI() + 1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_GENERIC_ERROR", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/013_H2M_GENERIC_ERROR.lua b/test_scripts/AppServices/PerformAppServiceInteraction/013_H2M_GENERIC_ERROR.lua new file mode 100644 index 0000000000..d8bd5bd362 --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/013_H2M_GENERIC_ERROR.lua @@ -0,0 +1,85 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PublishAppService +-- 3) Application has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.PerformAppServiceInteraction RPC request with Application's serviceID +-- +-- Expected: +-- 1) SDL forwards the PerformAppServiceInteraction request to Application as PerformAppServiceInteraction +-- 2) Application does not respond to SDL +-- 3) SDL sends a GENERIC_ERROR response to the HMI when the request times out +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local hmiOriginID = "HMI_ORIGIN_ID" + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + code = 22, --GENERIC_ERROR + data = { + method = rpc.hmiName + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = service_id + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, requestParams) + local passedRequestParams = requestParams + -- Core manually sets the originApp parameter when passing an HMI message through + passedRequestParams.originApp = hmiOriginID + -- Do not respond to request + mobileSession:ExpectRequest(rpc.name, passedRequestParams) + + EXPECT_HMIRESPONSE(cid, { + error = expectedResponse + }):Timeout(runner.testSettings.defaultTimeout + common.getRpcPassThroughTimeoutFromINI() + 1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Set HMI Origin ID", common.setSDLIniParameter, { "HMIOriginID", hmiOriginID }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_GENERIC_ERROR", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/014_M2M_Unknown_ServiceId.lua b/test_scripts/AppServices/PerformAppServiceInteraction/014_M2M_Unknown_ServiceId.lua new file mode 100644 index 0000000000..7fc0a89a1b --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/014_M2M_Unknown_ServiceId.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) Specific permissions are assigned for with PublishAppService +-- 4) Specific permissions are assigned for with PerformAppServiceInteraction +-- 5) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) Application 2 sends a PerformAppServiceInteraction RPC request with unknown serviceID +-- +-- Expected: +-- 1) SDL responds to Application 2 with {success = false, resultCode = "INVALID_ID"} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + params = { + originApp = config.application2.registerAppInterfaceParams.fullAppID, + serviceUri = "mobile:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = nil, + success = false, + resultCode = "INVALID_ID" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(1) + local mobileSession2 = common.getMobileSession(2) + local requestParams = rpc.params + requestParams.serviceID = "not a service id" + local cid = mobileSession2:SendRPC(rpc.name, requestParams) + + -- Request is NOT forwarded to ASP + mobileSession:ExpectRequest(rpc.name, requestParams):Times(0) + + mobileSession2:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_INVALID_ID", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/015_M2H_Unknown_ServiceId.lua b/test_scripts/AppServices/PerformAppServiceInteraction/015_M2H_Unknown_ServiceId.lua new file mode 100644 index 0000000000..d7575409ba --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/015_M2H_Unknown_ServiceId.lua @@ -0,0 +1,75 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PerformAppServiceInteraction +-- 3) HMI has published a MEDIA service +-- +-- Steps: +-- 1) Application sends a PerformAppServiceInteraction RPC request with unknown serviceID +-- +-- Expected: +-- 1) SDL responds to the Application with {success = false, resultCode = "INVALID_ID"} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "HMI_MEDIA_SERVICE", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + originApp = config.application1.registerAppInterfaceParams.fullAppID, + serviceUri = "hmi:sample.service.uri" + } +} + +local expectedResponse = { + serviceSpecificResult = nil, + success = false, + resultCode = "INVALID_ID" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local requestParams = rpc.params + requestParams.serviceID = "not a service id" + local cid = mobileSession:SendRPC(rpc.name, requestParams) + + -- Request is NOT forwarded to ASP + EXPECT_HMICALL(rpc.hmiName, requestParams):Times(0) + + mobileSession:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishEmbeddedAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_INVALID_ID", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PerformAppServiceInteraction/016_H2M_Unknown_ServiceId.lua b/test_scripts/AppServices/PerformAppServiceInteraction/016_H2M_Unknown_ServiceId.lua new file mode 100644 index 0000000000..724010a56a --- /dev/null +++ b/test_scripts/AppServices/PerformAppServiceInteraction/016_H2M_Unknown_ServiceId.lua @@ -0,0 +1,82 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PublishAppService +-- 3) Application 1 has published a MEDIA service +-- +-- Steps: +-- 1) HMI sends a AppService.PerformAppServiceInteraction RPC request with Application's serviceID +-- +-- Expected: +-- 1) SDL responds to the HMI with {code = "INVALID_ID"} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local hmiOriginID = "HMI_ORIGIN_ID" + +local rpc = { + name = "PerformAppServiceInteraction", + hmiName = "AppService.PerformAppServiceInteraction", + params = { + serviceUri = "mobile:sample.service.uri" + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession() + local service_id = common.getAppServiceID() + local requestParams = rpc.params + requestParams.serviceID = "not a service id" + local cid = common.getHMIConnection():SendRequest(rpc.hmiName, requestParams) + local passedRequestParams = requestParams + passedRequestParams.originApp = hmiOriginID + + -- Request is NOT forwarded to ASP + mobileSession:ExpectRequest(rpc.name, passedRequestParams):Times(0) + + EXPECT_HMIRESPONSE(cid, { + result = { + serviceSpecificResult = nil, + code = 13, --INVALID_ID (HMI_API) + data = { + method = rpc.hmiName + } + } + }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Set HMI Origin ID", common.setSDLIniParameter, { "HMIOriginID", hmiOriginID }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_INVALID_ID", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/PublishAppService/001_Mobile_success_flow.lua b/test_scripts/AppServices/PublishAppService/001_Mobile_success_flow.lua new file mode 100644 index 0000000000..e2bc7640ee --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/001_Mobile_success_flow.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application sends a PublishAppService RPC request +-- +-- Expected: +-- 1) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to mobile app +-- 2) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to mobile app +-- 3) SDL responds to mobile app with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PublishAppService/002_HMI_success_flow.lua b/test_scripts/AppServices/PublishAppService/002_HMI_success_flow.lua new file mode 100644 index 0000000000..52a8a3ffbb --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/002_HMI_success_flow.lua @@ -0,0 +1,68 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- +-- Steps: +-- 1) HMI sends a PublishAppService RPC request +-- +-- Expected: +-- 1) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to HMI +-- 2) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to HMI +-- 3) SDL responds to HMI with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = "Embedded Media Service", + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "AppService.PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + result = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + code = 0, + method = "AppService.PublishAppService" + } +} + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local cid = common.getHMIConnection():SendRequest(rpc.name, rpc.params) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + EXPECT_HMIRESPONSE(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PublishAppService/003_Nav_success_flow.lua b/test_scripts/AppServices/PublishAppService/003_Nav_success_flow.lua new file mode 100644 index 0000000000..0454cecf08 --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/003_Nav_success_flow.lua @@ -0,0 +1,93 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application sends a PublishAppService RPC request for service type NAVIGATION +-- +-- Expected: +-- 1) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to mobile app and HMI +-- 2) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to mobile app and HMI +-- 3) SDL sends a OnSystemCapabilityUpdated(NAVIGATION) notification to the HMI +-- 4) SDL responds to mobile app with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local expectedNavCapabilities = { + systemCapability = + { + systemCapabilityType = "NAVIGATION", + navigationCapability = + { + getWayPointsEnabled = true, + sendLocationEnabled = true + } + } +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, "NAVIGATION"); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest), expectedNavCapabilities):Times(3) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PublishAppService/004_Weather_success_flow.lua b/test_scripts/AppServices/PublishAppService/004_Weather_success_flow.lua new file mode 100644 index 0000000000..9d6c2b5d72 --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/004_Weather_success_flow.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application sends a PublishAppService RPC request for service type WEATHER +-- +-- Expected: +-- 1) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to mobile app and HMI +-- 2) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to mobile app and HMI +-- 3) SDL responds to mobile app with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "WEATHER", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, "WEATHER"); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PublishAppService/005_Future_service_type_success_flow.lua b/test_scripts/AppServices/PublishAppService/005_Future_service_type_success_flow.lua new file mode 100644 index 0000000000..f5d8800302 --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/005_Future_service_type_success_flow.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application sends a PublishAppService RPC request for service type FUTURE +-- +-- Expected: +-- 1) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to mobile app and HMI +-- 2) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to mobile app and HMI +-- 3) SDL responds to mobile app with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "FUTURE", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, "FUTURE"); +end + +--[[ Local Functions ]] +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PublishAppService/006_Mobile_disallowed_flow.lua b/test_scripts/AppServices/PublishAppService/006_Mobile_disallowed_flow.lua new file mode 100644 index 0000000000..54c44808bc --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/006_Mobile_disallowed_flow.lua @@ -0,0 +1,111 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application sends a PublishAppService RPC request for service type NAVIGATION +-- 2) Application sends a PublishAppService RPC request with service_name = "BadServiceName" +-- 3) Application sends a PublishAppService RPC request with handled_rpc = {44} +-- +-- Expected for each step: +-- 1) SDL does NOT send a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to mobile app +-- 2) SDL does NOT send a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to mobile app +-- 3) SDL responds to mobile app with "resultCode: DISALLOWED" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + resultCode = "DISALLOWED" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1, "WEATHER"); +end + +--[[ Local Functions ]] +local function processServiceTypeDisallowed(self) + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(0) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(0) +end + +local function processServiceNameDisallowed(self) + rpc.params.appServiceManifest.serviceType = "WEATHER" + rpc.params.appServiceManifest.serviceName = "BadServiceName" + + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(0) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(0) +end + +local function processHandledRPCsDisallowed(self) + rpc.params.appServiceManifest.serviceName = config.application1.registerAppInterfaceParams.appName + rpc.params.appServiceManifest["handledRPCs"] = {44} + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(0) + mobileSession:ExpectResponse(cid, expectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(0) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_disallowed_by_service_type", processServiceTypeDisallowed) +runner.Step("RPC " .. rpc.name .. "_disallowed_by_service_name", processServiceNameDisallowed) +runner.Step("RPC " .. rpc.name .. "_disallowed_by_handled_rpcs", processHandledRPCsDisallowed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/PublishAppService/007_Mobile_unknown_param_success.lua b/test_scripts/AppServices/PublishAppService/007_Mobile_unknown_param_success.lua new file mode 100644 index 0000000000..cfc92f91dc --- /dev/null +++ b/test_scripts/AppServices/PublishAppService/007_Mobile_unknown_param_success.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application sends a PublishAppService RPC request. Request contains two parameters that are unknown to the rpc spec. +-- +-- Expected: +-- 1) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, PUBLISHED) notification to mobile app +-- 2) SDL sends a OnSystemCapabilityUpdated(APP_SERVICES, ACTIVATED) notification to mobile app +-- 3) SDL responds to mobile app with "resultCode: SUCCESS, success: true" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = { + futureMediaManifestdata = true + }, + futureServiceManifestData = true +} + +local rpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local expectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +--[[ Local Functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +local function processRPCSuccess(self) + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + mobileSession:ExpectResponse(cid, expectedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("Set config.ValidateSchema = false", common.setValidateSchema, {false}) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/RPCPassThrough/001_SendLocation_Handled_Request.lua b/test_scripts/AppServices/RPCPassThrough/001_SendLocation_Handled_Request.lua new file mode 100644 index 0000000000..1e06ab70bf --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/001_SendLocation_Handled_Request.lua @@ -0,0 +1,100 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for +-- 3) SendLocation permissions are assigned for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest) +-- +-- Steps: +-- 1) app2 sends a SendLocation request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to core with { success = true, resultCode = "SUCCESS", info = "Request was handled by app services" } +-- 3) Core forwards the response from app1 to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = {39}, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcRequest = { + name = "SendLocation", + hmi_name = "Navigation.SendLocation", + params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + }, + hmi_params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + } +} + +local rpcResponse = { + params = successResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 39}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" , "SendLocation" } + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Do(function(_, data) + providerMobileSession:SendResponse(rpcRequest.name, data.rpcCorrelationId, successResponse) + end) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_SUCCESS", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/002_SendLocation_Unsupported_Request.lua b/test_scripts/AppServices/RPCPassThrough/002_SendLocation_Unsupported_Request.lua new file mode 100644 index 0000000000..9a721cb8ba --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/002_SendLocation_Unsupported_Request.lua @@ -0,0 +1,108 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for +-- 3) SendLocation permissions are assigned for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest) +-- +-- Steps: +-- 1) app2 sends a SendLocation request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to core with { success = false, resultCode = "UNSUPPORTED_REQUEST", info = "Request CANNOT be handled by app services" } +-- 3) Core handles the original SendLocation request and sends {success = true, resultCode = "SUCCESS", info = nil} to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = {39}, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local unsupportedResponse = { + success = false, + resultCode = "UNSUPPORTED_REQUEST", + info = "Request CANNOT be handled by app services" +} + +local rpcRequest = { + name = "SendLocation", + hmi_name = "Navigation.SendLocation", + params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + }, + hmi_params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + } +} + +local rpcResponse = { + params = {success = true, resultCode = "SUCCESS", info = nil}, + hmi_result = { + code = "SUCCESS", + params = {} + } +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 39}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" , "SendLocation" } + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Do(function(_, data) + providerMobileSession:SendResponse(rpcRequest.name, data.rpcCorrelationId, unsupportedResponse) + end) + + --Core will handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(1) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, rpcResponse.hmi_result.code, rpcResponse.hmi_result.params) + end) + + mobileSession:ExpectResponse(cid, rpcResponse.params) + +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_UNSUPPORTED", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/003_SendLocation_Request_Timeout.lua b/test_scripts/AppServices/RPCPassThrough/003_SendLocation_Request_Timeout.lua new file mode 100644 index 0000000000..9b25e7b655 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/003_SendLocation_Request_Timeout.lua @@ -0,0 +1,109 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for +-- 3) SendLocation permissions are assigned for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest) +-- +-- Steps: +-- 1) app2 sends a SendLocation request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 does not respond to the request in time +-- 3) Core handles the original SendLocation request and sends {success = true, resultCode = "SUCCESS", info = nil} to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { 39 }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcRequest = { + name = "SendLocation", + hmi_name = "Navigation.SendLocation", + params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + }, + hmi_params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + } +} + +local rpcResponse = { + params = {success = true, resultCode = "SUCCESS", info = nil}, + hmi_result = { + code = "SUCCESS", + params = {} + } +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 39}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" , "SendLocation" } + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Do(function(_, data) + RUN_AFTER((function() + providerMobileSession:SendResponse(rpcRequest.name, data.rpcCorrelationId, successResponse) + end), common.getRpcPassThroughTimeoutFromINI() + 1000) + end) + + --Core will handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(1) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, rpcResponse.hmi_result.code, rpcResponse.hmi_result.params) + end) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_TIMEOUT", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/004_SendLocation_MultipleAS.lua b/test_scripts/AppServices/RPCPassThrough/004_SendLocation_MultipleAS.lua new file mode 100644 index 0000000000..f80d28f0ef --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/004_SendLocation_MultipleAS.lua @@ -0,0 +1,141 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1, app2 and app3 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for +-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc SendLocation) are assigned for +-- 4) SendLocation permissions are assigned for +-- 5) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest) +-- 6) app2 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=SendLocation} in the manifest) +-- +-- Steps: +-- 1) app3 sends a SendLocation request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to core with { success = false, resultCode = "UNSUPPORTED_REQUEST", info = "Request CANNOT be handled by app services" } +-- 3) Core forwards the request to app2 +-- 2) app2 responds to core with { success = true, resultCode = "SUCCESS", info = "Request was handled by app services" } +-- 3) Core forwards the response from app2 to app3 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { 39 }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local manifest2 = { + serviceName = config.application2.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + handledRPCs = { 39 }, + allowAppConsumers = true, + rpcSpecVersion = config.application2.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local unsupportedResponse = { + success = false, + resultCode = "UNSUPPORTED_REQUEST", + info = "Request CANNOT be handled by app services" +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcRequest = { + name = "SendLocation", + hmi_name = "Navigation.SendLocation", + params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + }, + hmi_params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + } +} + +local rpcResponse = { + params = successResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 39}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppServiceProducerConfig(2) + pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 39}} + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry + --Add permissions for app3 + pt_entry = common.getAppDataForPTU(3) + pt_entry.groups = { "Base-4" , "SendLocation" } + tbl.policy_table.app_policies[common.getConfigAppParams(3).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local firstProviderMobileSession = common.getMobileSession(1) + local secondProviderMobileSession = common.getMobileSession(2) + local mobileSession = common.getMobileSession(3) + local canHandleRequest = false + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + firstProviderMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Do(function(_, data) + local ASPResponse = successResponse + if not canHandleRequest then + canHandleRequest = true + ASPResponse = unsupportedResponse + end + firstProviderMobileSession:SendResponse(rpcRequest.name, data.rpcCorrelationId, ASPResponse) + end) + + secondProviderMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Do(function(_, data) + local ASPResponse = successResponse + if not canHandleRequest then + canHandleRequest = true + ASPResponse = unsupportedResponse + end + secondProviderMobileSession:SendResponse(rpcRequest.name, data.rpcCorrelationId, ASPResponse) + end) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Publish NAVIGATION AppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Publish MEDIA AppService", common.publishMobileAppService, { manifest2, 2 }) +runner.Step("RAI App 3", common.registerAppWOPTU, { 3 }) +runner.Step("Activate App", common.activateApp, { 3 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_MultipleAS", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/005_SendLocation_Invalid_Permissions.lua b/test_scripts/AppServices/RPCPassThrough/005_SendLocation_Invalid_Permissions.lua new file mode 100644 index 0000000000..0b4002d9e1 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/005_SendLocation_Invalid_Permissions.lua @@ -0,0 +1,88 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc SendLocation) are assigned for +-- 3) SendLocation permissions are NOT assigned for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=SendLocation} in the manifest) +-- +-- Steps: +-- 1) app2 sends a SendLocation request to core +-- +-- Expected: +-- 1) Core responds to app2 with {success = false, resultCode = "DISALLOWED"} +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = {39}, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local disallowedResponse = { + success = false, + resultCode = "DISALLOWED", +} + +local rpcRequest = { + name = "SendLocation", + hmi_name = "Navigation.SendLocation", + params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + }, + hmi_params = { + longitudeDegrees = 50, + latitudeDegrees = 50, + locationName = "TestLocation" + } +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = 39}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + --Provider will NOT be forwarded the request + providerMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Times(0) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, disallowedResponse) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_DISALLOWED", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/006_ButtonPress_Handled_Request.lua b/test_scripts/AppServices/RPCPassThrough/006_ButtonPress_Handled_Request.lua new file mode 100644 index 0000000000..8595d57358 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/006_ButtonPress_Handled_Request.lua @@ -0,0 +1,100 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc ButtonPress) are assigned for +-- 3) RemoteControl permissions are assigned for +-- 4) app1 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=ButtonPress} in the manifest) +-- +-- Steps: +-- 1) app2 sends a ButtonPress request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to core with { success = true, resultCode = "SUCCESS", info = "Request was handled by app services" } +-- 3) Core forwards the response from app1 to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + handledRPCs = {41}, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcRequest = { + name = "ButtonPress", + hmi_name = "Buttons.ButtonPress", + params = { + moduleType = "RADIO", + buttonName = "OK", + buttonPressMode = "SHORT" + }, + hmi_params = { + moduleType = "RADIO", + buttonName = "OK", + buttonPressMode = "SHORT" + } +} + +local rpcResponse = { + params = successResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 41}} + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" , "RemoteControl" } + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Do(function(_, data) + providerMobileSession:SendResponse(rpcRequest.name, data.rpcCorrelationId, successResponse) + end) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_SUCCESS", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/007_ButtonPress_Invalid_Permissions.lua b/test_scripts/AppServices/RPCPassThrough/007_ButtonPress_Invalid_Permissions.lua new file mode 100644 index 0000000000..d49f39a442 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/007_ButtonPress_Invalid_Permissions.lua @@ -0,0 +1,93 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc ButtonPress) are assigned for +-- 3) RemoteControl permissions are NOT assigned for +-- 4) app1 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=ButtonPress} in the manifest) +-- +-- Steps: +-- 1) app2 sends a ButtonPress request to core +-- +-- Expected: +-- 1) Core responds to app2 with {success = false, resultCode = "DISALLOWED"} +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + handledRPCs = {41}, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcRequest = { + name = "ButtonPress", + hmi_name = "Buttons.ButtonPress", + params = { + moduleType = "RADIO", + buttonName = "OK", + buttonPressMode = "SHORT" + }, + hmi_params = { + moduleType = "RADIO", + buttonName = "OK", + buttonPressMode = "SHORT" + } +} + +local rpcResponse = { + params = {success = false, resultCode="DISALLOWED"} +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = 41}} + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.name, rpcRequest.params) + + --Provider will NOT be forwarded the request + providerMobileSession:ExpectRequest(rpcRequest.name, rpcRequest.params):Times(0) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_DISALLOWED", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/008_PTU_allow_unknown_rpc_passthrough.lua b/test_scripts/AppServices/RPCPassThrough/008_PTU_allow_unknown_rpc_passthrough.lua new file mode 100644 index 0000000000..a694481c83 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/008_PTU_allow_unknown_rpc_passthrough.lua @@ -0,0 +1,48 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) PTU is completed with permissions all_unknown_rpc_passthrough = true +-- +-- Steps: +-- 1) HMI initiates PTU to deliver PT snapshot to mobile +-- +-- Expected: +-- 1) PT Snapshot contains permissions all_unknown_rpc_passthrough = true +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID]["allow_unknown_rpc_passthrough"] = true +end + +local function verifyAllowUnknownRPCPassthrough() + local snp_tbl = common.GetPolicySnapshot() + local app_id = common.getConfigAppParams(1).fullAppID + local result = {} + result.allow_unknown_rpc_passthrough = snp_tbl.policy_table.app_policies[app_id].allow_unknown_rpc_passthrough + common.test_assert(result.allow_unknown_rpc_passthrough == true, "Incorrect result value") +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Request PTU", common.Request_PTU) +runner.Step("Validate PTU", verifyAllowUnknownRPCPassthrough) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/RPCPassThrough/009_UnknownRPC_Consumer_UNSUPPORTED_REQUEST_policy_allow_flag_false.lua b/test_scripts/AppServices/RPCPassThrough/009_UnknownRPC_Consumer_UNSUPPORTED_REQUEST_policy_allow_flag_false.lua new file mode 100644 index 0000000000..e3943ac9fb --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/009_UnknownRPC_Consumer_UNSUPPORTED_REQUEST_policy_allow_flag_false.lua @@ -0,0 +1,100 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc FutureRequest) are assigned for +-- 3) allow_unknown_rpc_passthrough is set to false for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=FutureRequest} in the manifest) +-- +-- Steps: +-- 1) app2 sends a FutureRequest request to core +-- +-- Expected: +-- 1) Core does not forward the request to any provider application +-- 2) Core responds to app2 with { success = false, resultCode = "UNSUPPORTED_REQUEST" } +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local rpcRequest = { + name = "FutureRequest", + hmi_name = "FutureInterface.FutureRequest", + func_id = 956, + params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + }, + hmi_params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + } +} + +local unsupportedResponse = { + success = false, + resultCode = "UNSUPPORTED_REQUEST" +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { rpcRequest.func_id }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local rpcResponse = { + params = unsupportedResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = rpcRequest.func_id}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" } + pt_entry.allow_unknown_rpc_passthrough = false + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.func_id, rpcRequest.params) + + -- Core will NOT pass the message to mobile provider + providerMobileSession:ExpectRequest(rpcRequest.func_id, rpcRequest.params):Times(0) + + --Core will NOT attempt to process message + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + --Core will respond with UNSUPPORTED_REQUEST because the RPC is unknown + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_UNSUPPORTED", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/010_UnknownRpc_Handled_Request.lua b/test_scripts/AppServices/RPCPassThrough/010_UnknownRpc_Handled_Request.lua new file mode 100644 index 0000000000..eed5a5fa5d --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/010_UnknownRpc_Handled_Request.lua @@ -0,0 +1,102 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc FutureRequest) are assigned for +-- 3) allow_unknown_rpc_passthrough is set to true for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=FutureRequest} in the manifest) +-- +-- Steps: +-- 1) app2 sends a FutureRequest request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to core with { success = true, resultCode = "SUCCESS", info = "Request was handled by app services" } +-- 3) Core forwards the response from app1 to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local rpcRequest = { + name = "FutureRequest", + hmi_name = "FutureInterface.FutureRequest", + func_id = 956, + params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + }, + hmi_params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + } +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { rpcRequest.func_id }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcResponse = { + params = successResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = rpcRequest.func_id}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" } + pt_entry.allow_unknown_rpc_passthrough = true + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.func_id, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.func_id, rpcRequest.params):Do(function(_, data) + providerMobileSession:SendResponse(rpcRequest.func_id, data.rpcCorrelationId, successResponse) + end) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_SUCCESS", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/011_UnknownRpc_Unsupported_Request.lua b/test_scripts/AppServices/RPCPassThrough/011_UnknownRpc_Unsupported_Request.lua new file mode 100644 index 0000000000..852afa8e93 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/011_UnknownRpc_Unsupported_Request.lua @@ -0,0 +1,102 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc FutureRequest) are assigned for +-- 3) allow_unknown_rpc_passthrough is set to true for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=FutureRequest} in the manifest) +-- +-- Steps: +-- 1) app2 sends a FutureRequest request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to Core with { success = false, resultCode = "UNSUPPORTED_REQUEST", info = "Request CANNOT be handled by app services" } +-- 3) Core sees that the original request function ID is unknown and sends {success = true, resultCode = "UNSUPPORTED_REQUEST"} to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local rpcRequest = { + name = "FutureRequest", + hmi_name = "FutureInterface.FutureRequest", + func_id = 956, + params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + }, + hmi_params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + } +} + +local unsupportedResponse = { + success = false, + resultCode = "UNSUPPORTED_REQUEST" +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { rpcRequest.func_id }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local rpcResponse = { + params = unsupportedResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = rpcRequest.func_id}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" } + pt_entry.allow_unknown_rpc_passthrough = true + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.func_id, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.func_id, rpcRequest.params):Do(function(_, data) + providerMobileSession:SendResponse(rpcRequest.func_id, data.rpcCorrelationId, unsupportedResponse) + end) + + --Core will NOT attempt to process message + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + --Core will respond with UNSUPPORTED_REQUEST because the RPC is unknown + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_UNSUPPORTED", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/012_UnknownRpc_Request_Timeout.lua b/test_scripts/AppServices/RPCPassThrough/012_UnknownRpc_Request_Timeout.lua new file mode 100644 index 0000000000..ff261f292f --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/012_UnknownRpc_Request_Timeout.lua @@ -0,0 +1,110 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1 and app2 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc FutureRequest) are assigned for +-- 3) allow_unknown_rpc_passthrough is set to true for +-- 4) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=FutureRequest} in the manifest) +-- +-- Steps: +-- 1) app2 sends a FutureRequest request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 does not respond to the request in time +-- 3) Core sees that the original request function ID is unknown and sends {success = true, resultCode = "UNSUPPORTED_REQUEST"} to app2 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local rpcRequest = { + name = "FutureRequest", + hmi_name = "FutureInterface.FutureRequest", + func_id = 956, + params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + }, + hmi_params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + } +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local unsupportedResponse = { + success = false, + resultCode = "UNSUPPORTED_REQUEST" +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { rpcRequest.func_id }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local rpcResponse = { + params = unsupportedResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = rpcRequest.func_id}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" } + pt_entry.allow_unknown_rpc_passthrough = true + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local providerMobileSession = common.getMobileSession(1) + local mobileSession = common.getMobileSession(2) + + local cid = mobileSession:SendRPC(rpcRequest.func_id, rpcRequest.params) + + providerMobileSession:ExpectRequest(rpcRequest.func_id, rpcRequest.params):Do(function(_, data) + RUN_AFTER((function() + providerMobileSession:SendResponse(rpcRequest.func_id, data.rpcCorrelationId, successResponse) + end), common.getRpcPassThroughTimeoutFromINI() + 1000) + end) + + --Core will NOT attempt to process message + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + --Core will respond with UNSUPPORTED_REQUEST because the RPC is unknown + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("PublishAppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_TIMEOUT", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/RPCPassThrough/013_UnknownRpc_MultipleAS.lua b/test_scripts/AppServices/RPCPassThrough/013_UnknownRpc_MultipleAS.lua new file mode 100644 index 0000000000..a6a3ff6f07 --- /dev/null +++ b/test_scripts/AppServices/RPCPassThrough/013_UnknownRpc_MultipleAS.lua @@ -0,0 +1,143 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) app1, app2 and app3 are registered on SDL. +-- 2) AppServiceProvider permissions(with NAVIGATION AppService permissions to handle rpc FutureRequest) are assigned for +-- 3) AppServiceProvider permissions(with MEDIA AppService permissions to handle rpc FutureRequest) are assigned for +-- 4) allow_unknown_rpc_passthrough is set to true for +-- 5) app1 sends a PublishAppService (with {serviceType=NAVIGATION, handledRPC=FutureRequest} in the manifest) +-- 6) app2 sends a PublishAppService (with {serviceType=MEDIA, handledRPC=FutureRequest} in the manifest) +-- +-- Steps: +-- 1) app3 sends a FutureRequest (functionID = 956) request to core +-- +-- Expected: +-- 1) Core forwards the request to app1 +-- 2) app1 responds to core with { success = false, resultCode = "UNSUPPORTED_REQUEST", info = "Request CANNOT be handled by app services" } +-- 3) Core forwards the request to app2 +-- 2) app2 responds to core with { success = true, resultCode = "SUCCESS", info = "Request was handled by app services" } +-- 3) Core forwards the response from app2 to app3 +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +local rpcRequest = { + name = "FutureRequest", + hmi_name = "FutureInterface.FutureRequest", + func_id = 956, + params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + }, + hmi_params = { + futureParam = 50, + futureParam2 = { 50 }, + futureParam3 = "StringValue" + } +} + +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "NAVIGATION", + handledRPCs = { rpcRequest.func_id }, + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + navigationServiceManifest = {} +} + +local manifest2 = { + serviceName = config.application2.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + handledRPCs = { rpcRequest.func_id }, + allowAppConsumers = true, + rpcSpecVersion = config.application2.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local unsupportedResponse = { + success = false, + resultCode = "UNSUPPORTED_REQUEST", + info = "Request CANNOT be handled by app services" +} + +local successResponse = { + success = true, + resultCode = "SUCCESS", + info = "Request was handled by app services" +} + +local rpcResponse = { + params = successResponse +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + --Add permissions for app1 + local pt_entry = common.getAppServiceProducerConfig(1) + pt_entry.app_services.NAVIGATION = { handled_rpcs = {{function_id = rpcRequest.func_id}} } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + --Add permissions for app2 + pt_entry = common.getAppServiceProducerConfig(2) + pt_entry.app_services.MEDIA.handled_rpcs = {{function_id = rpcRequest.func_id}} + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry + --Add permissions for app3 + pt_entry = common.getAppDataForPTU(3) + pt_entry.groups = { "Base-4" } + pt_entry.allow_unknown_rpc_passthrough = true + tbl.policy_table.app_policies[common.getConfigAppParams(3).fullAppID] = pt_entry +end + +local function RPCPassThruTest() + local firstProviderMobileSession = common.getMobileSession(1) + local secondProviderMobileSession = common.getMobileSession(2) + local mobileSession = common.getMobileSession(3) + local canHandleRequest = false + + local cid = mobileSession:SendRPC(rpcRequest.func_id, rpcRequest.params) + + firstProviderMobileSession:ExpectRequest(rpcRequest.func_id, rpcRequest.params):Do(function(_, data) + local ASPResponse = successResponse + if not canHandleRequest then + canHandleRequest = true + ASPResponse = unsupportedResponse + end + firstProviderMobileSession:SendResponse(rpcRequest.func_id, data.rpcCorrelationId, ASPResponse) + end) + + secondProviderMobileSession:ExpectRequest(rpcRequest.func_id, rpcRequest.params):Do(function(_, data) + local ASPResponse = successResponse + if not canHandleRequest then + canHandleRequest = true + ASPResponse = unsupportedResponse + end + secondProviderMobileSession:SendResponse(rpcRequest.func_id, data.rpcCorrelationId, ASPResponse) + end) + + --Core will NOT handle the RPC + EXPECT_HMICALL(rpcRequest.hmi_name, rpcRequest.hmi_params):Times(0) + + mobileSession:ExpectResponse(cid, rpcResponse.params) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Publish NAVIGATION AppService", common.publishMobileAppService, { manifest, 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Publish MEDIA AppService", common.publishMobileAppService, { manifest2, 2 }) +runner.Step("RAI App 3", common.registerAppWOPTU, { 3 }) +runner.Step("Activate App", common.activateApp, { 3 }) + +runner.Title("Test") +runner.Step("RPCPassThroughTest_MultipleAS", RPCPassThruTest) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/SystemCapabilities/001_GetSystemCapability_success.lua b/test_scripts/AppServices/SystemCapabilities/001_GetSystemCapability_success.lua new file mode 100644 index 0000000000..b2463baf1e --- /dev/null +++ b/test_scripts/AppServices/SystemCapabilities/001_GetSystemCapability_success.lua @@ -0,0 +1,111 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application 2 sends a GetSystemCapability RPC request with subscribe = true +-- 2) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) App 2 gets a GetSystemCapability response SUCCESS +-- 2) App 1, App 2, and HMI, all get OnSystemCapabilityUpdated notifications +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetSystemCapability", + params = { + systemCapabilityType = "APP_SERVICES", + subscribe = true + } +} + +local expectedResponse = { + success = true, + resultCode = "SUCCESS" +} + +local publishRpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local publishExpectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function GetSystemCapabilitySubscribe(self) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local responseParams = expectedResponse + + mobileSession2:ExpectResponse(cid, responseParams) +end + +local function PublishServiceExpectNotification(self) + local mobileSession = common.getMobileSession(self, 1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession:SendRPC(publishRpc.name, publishRpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + + mobileSession:ExpectResponse(cid, publishExpectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", GetSystemCapabilitySubscribe) +runner.Step("Publish Service and expect OnSystemCapabilityUpdate", PublishServiceExpectNotification) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/SystemCapabilities/002_GetSystemCapabilitySubscribe_OnSystemCapability_on_unregister.lua b/test_scripts/AppServices/SystemCapabilities/002_GetSystemCapabilitySubscribe_OnSystemCapability_on_unregister.lua new file mode 100644 index 0000000000..e95e32560f --- /dev/null +++ b/test_scripts/AppServices/SystemCapabilities/002_GetSystemCapabilitySubscribe_OnSystemCapability_on_unregister.lua @@ -0,0 +1,112 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 2) Application 2 sends a GetSystemCapability RPC request with subscribe true +-- 3) Application 1 sends UnregisterAppInterface +-- +-- Expected: +-- 1) SDL responds with GetSystemCapability SUCCESS +-- 2) SDL send OnSystemCapabilityUpdated:REMOVED after app1 unregisters +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetSystemCapability", + params = { + systemCapabilityType = "APP_SERVICES", + subscribe = true + } +} + +local expectedResponse = { + success = true, + resultCode = "SUCCESS" +} + +local publishRpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local publishExpectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function GetSystemCapabilitySubscribe(self) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local responseParams = expectedResponse + responseParams["systemCapability"] = common.appServiceCapabilityUpdateParams("ACTIVE", manifest).systemCapability + responseParams.systemCapability.appServicesCapabilities.appServices[1].updateReason = nil + mobileSession2:ExpectResponse(cid, responseParams) +end + +local function UnregisterAppExpectNotification(self) + local mobileSession = common.getMobileSession(self, 1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession:SendRPC("UnregisterAppInterface", {}) + local unregister_response = { + success = true, + resultCode = "SUCCESS" + } + + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("REMOVED", manifest)):Times(1) + + mobileSession:ExpectResponse(cid, unregister_response) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("REMOVED", manifest)):Times(1) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", GetSystemCapabilitySubscribe) +runner.Step("Disconnect app service and expect OnSystemCapabilityUpdate", UnregisterAppExpectNotification) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/SystemCapabilities/003_OnSystemCapability_on_deactivate_service.lua b/test_scripts/AppServices/SystemCapabilities/003_OnSystemCapability_on_deactivate_service.lua new file mode 100644 index 0000000000..7b3fca53b5 --- /dev/null +++ b/test_scripts/AppServices/SystemCapabilities/003_OnSystemCapability_on_deactivate_service.lua @@ -0,0 +1,112 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 2) Application 2 sends a GetSystemCapability RPC request with subscribe true +-- 3) HMI sends ActivateAppService:false +-- +-- Expected: +-- 1) SDL responds with GetSystemCapability SUCCESS +-- 2) SDL send OnSystemCapabilityUpdated:DEACTIVATED after HMI deactivates the servce +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetSystemCapability", + params = { + systemCapabilityType = "APP_SERVICES", + subscribe = true + } +} + +local expectedResponse = { + success = true, + resultCode = "SUCCESS" +} + +local publishRpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local publishExpectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function GetSystemCapabilitySubscribe(self) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local responseParams = expectedResponse + responseParams["systemCapability"] = common.appServiceCapabilityUpdateParams("ACTIVE", manifest).systemCapability + responseParams.systemCapability.appServicesCapabilities.appServices[1].updateReason = nil + mobileSession2:ExpectResponse(cid, responseParams) +end + +local function DeactivateServiceExpectNotification(self) + local mobileSession = common.getMobileSession(self, 1) + local mobileSession2 = common.getMobileSession(2) + local cid = common.getHMIConnection():SendRequest("AppService.AppServiceActivation", { + activate = false, + serviceID = common.getAppServiceID() + }) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(1) + + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(1) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(1) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", GetSystemCapabilitySubscribe) +runner.Step("Disconnect app service and expect OnSystemCapabilityUpdate", DeactivateServiceExpectNotification) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/SystemCapabilities/004_GetSystemCapability_unsubscribe.lua b/test_scripts/AppServices/SystemCapabilities/004_GetSystemCapability_unsubscribe.lua new file mode 100644 index 0000000000..95db5ff430 --- /dev/null +++ b/test_scripts/AppServices/SystemCapabilities/004_GetSystemCapability_unsubscribe.lua @@ -0,0 +1,135 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- +-- Steps: +-- 1) Application 2 sends a GetSystemCapability RPC request with subscribe = true +-- 2) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- 3) Application 2 sends a GetSystemCapability RPC request with subscribe = false +-- 4) HMI sends ActivateAppService:false +-- +-- Expected: +-- 1) App 2 gets a GetSystemCapability response SUCCESS +-- 2) App 1 and HMI get OnSystemCapabilityUpdated notifications +-- 3) App 2 is unsubscribed from system capability updates and does not receive OnSystemCapabilityUpdated +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = {} +} + +local rpc = { + name = "GetSystemCapability", + params = { + systemCapabilityType = "APP_SERVICES", + subscribe = true + } +} + +local expectedResponse = { + success = true, + resultCode = "SUCCESS" +} + +local publishRpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local publishExpectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); +end + +--[[ Local Functions ]] +local function GetSystemCapabilitySubscribe(self) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local responseParams = expectedResponse + + mobileSession2:ExpectResponse(cid, responseParams) +end + +local function PublishServiceExpectNotification(self) + local mobileSession2 = common.getMobileSession(2) + + common.publishMobileAppService(manifest, 1) + + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + +end + +local function GetSystemCapabilityUnsubscribe(self) + local mobileSession2 = common.getMobileSession(2) + params = rpc.params + params.subscribe = false + local cid = mobileSession2:SendRPC(rpc.name, params) + local responseParams = expectedResponse + + mobileSession2:ExpectResponse(cid, responseParams) +end + +local function DeactivateService(self) + local mobileSession = common.getMobileSession(self, 1) + local mobileSession2 = common.getMobileSession(2) + local cid = common.getHMIConnection():SendRequest("AppService.AppServiceActivation", { + activate = false, + serviceID = common.getAppServiceID() + }) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(1) + + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(0) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("DEACTIVATED", manifest)):Times(1) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Activate App", common.activateApp, { 2 }) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", GetSystemCapabilitySubscribe) +runner.Step("Publish Service and expect OnSystemCapabilityUpdate", PublishServiceExpectNotification) +runner.Step("GetSystemCapability_unsubscribe_SUCCESS", GetSystemCapabilityUnsubscribe) +runner.Step("DeactivateService_expect_no_notification", DeactivateService) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/AppServices/SystemCapabilities/005_OnSystemCapability_unknown_parameter_success.lua b/test_scripts/AppServices/SystemCapabilities/005_OnSystemCapability_unknown_parameter_success.lua new file mode 100644 index 0000000000..71c5badc6a --- /dev/null +++ b/test_scripts/AppServices/SystemCapabilities/005_OnSystemCapability_unknown_parameter_success.lua @@ -0,0 +1,118 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application 1 with is registered on SDL. +-- 2) Application 2 with is registered on SDL. +-- 3) AppServiceProvider permissions are assigned for with PublishAppService +-- 4) AppServiceConsumer permissions are assigned for with GetSystemCapability +-- +-- Steps: +-- 1) Application 2 sends a GetSystemCapability RPC request with subscribe = true +-- 2) Application 1 sends a PublishAppService RPC request with serviceType MEDIA +-- +-- Expected: +-- 1) App 2 gets a GetSystemCapability response SUCCESS +-- 2) App 1, App 2, and HMI, all get OnSystemCapabilityUpdated notifications +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = config.application1.registerAppInterfaceParams.appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = config.application1.registerAppInterfaceParams.syncMsgVersion, + mediaServiceManifest = { + futureMediaData = "future media data" + }, + futureManifestStruct = { + futureStructItem = "future struct item" + } +} + +local rpc = { + name = "GetSystemCapability", + params = { + systemCapabilityType = "APP_SERVICES", + subscribe = true + } +} + +local expectedResponse = { + success = true, + resultCode = "SUCCESS" +} + +local publishRpc = { + name = "PublishAppService", + params = { + appServiceManifest = manifest + } +} + +local publishExpectedResponse = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true, + serviceActive = true + }, + success = true, + resultCode = "SUCCESS" +} + +--[[ Local Functions ]] +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceProducerConfig(1); + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = common.getAppServiceConsumerConfig(2); +end + +local function GetSystemCapabilitySubscribe(self) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession2:SendRPC(rpc.name, rpc.params) + local responseParams = expectedResponse + + mobileSession2:ExpectResponse(cid, responseParams) +end + +local function PublishServiceExpectNotification(self) + local mobileSession = common.getMobileSession(self, 1) + local mobileSession2 = common.getMobileSession(2) + local cid = mobileSession:SendRPC(publishRpc.name, publishRpc.params) + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + + mobileSession2:ExpectNotification("OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) + + mobileSession:ExpectResponse(cid, publishExpectedResponse) + + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated", + common.appServiceCapabilityUpdateParams("PUBLISHED", manifest), + common.appServiceCapabilityUpdateParams("ACTIVATED", manifest)):Times(2) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp) +runner.Step("Activate App", common.activateApp, { 2 }) +runner.Step("Set config.ValidateSchema = false", common.setValidateSchema, {false}) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", GetSystemCapabilitySubscribe) +runner.Step("Publish Service and expect OnSystemCapabilityUpdate", PublishServiceExpectNotification) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/AppServices/commonAppServices.lua b/test_scripts/AppServices/commonAppServices.lua new file mode 100644 index 0000000000..0a9342949f --- /dev/null +++ b/test_scripts/AppServices/commonAppServices.lua @@ -0,0 +1,482 @@ +local actions = require("user_modules/sequences/actions") +local utils = require("user_modules/utils") +local test = require("user_modules/dummy_connecttest") + +local commonAppServices = actions + +local serviceIDs = {} + +function commonAppServices.appServiceCapability(update_reason, manifest) + local appService = { + updateReason = update_reason, + updatedAppServiceRecord = { + serviceManifest = manifest + } + } + if update_reason == "PUBLISHED" then + appService.updatedAppServiceRecord.servicePublished = true + appService.updatedAppServiceRecord.serviceActive = false + elseif update_reason == "REMOVED" then + appService.updatedAppServiceRecord.servicePublished = false + appService.updatedAppServiceRecord.serviceActive = false + elseif update_reason == "ACTIVATED" then + appService.updatedAppServiceRecord.servicePublished = true + appService.updatedAppServiceRecord.serviceActive = true + elseif update_reason == "DEACTIVATED" then + appService.updatedAppServiceRecord.servicePublished = true + appService.updatedAppServiceRecord.serviceActive = false + end + return appService +end + +local appServiceData = { + MEDIA = { + mediaServiceData = { + mediaType = "MUSIC", + mediaTitle = "Song name", + mediaArtist = "Band name", + mediaAlbum = "Album name", + playlistName = "Sample music", + isExplicit = true, + trackPlaybackProgress = 300, + trackPlaybackDuration = 400, + queuePlaybackProgress = 3200, + queuePlaybackDuration = 5000, + queueCurrentTrackNumber = 12, + queueTotalTrackCount = 25 + } + }, + NAVIGATION = { + navigationServiceData = { + timeStamp = { + hour = 2, + minute = 24, + second = 16 + }, + origin = { + locationName = "start" + }, + destination = { + locationName = "finish" + }, + destinationETA = { + hour = 2, + minute = 38, + second = 40 + }, + prompt = "Navigating to destination" + } + }, + WEATHER = { + weatherServiceData = { + location = { + locationName = "location" + }, + currentForecast = { + currentTemperature = { + unit = "CELSIUS", + value = 24.6 + }, + weatherSummary = "Windy", + humidity = 0.28, + cloudCover = 0.55, + moonPhase = 0.85, + windBearing = 180, + windGust = 2.0, + windSpeed = 50.0 + }, + alerts = { + { + title = "Weather Alert" + } + } + } + }, + FUTURE = { + futureServiceData = { + futureParam1 = "A String Value", + futureParam2 = 6, + futureParam3 = { + futureParam4 = 4.6 + } + } + } +} + +function commonAppServices.appServiceDataByType(service_id, service_type) + if not service_type then service_type = "MEDIA" end + local data = appServiceData[service_type] + if data == nil then + data = appServiceData["FUTURE"] + end + data.serviceType = service_type + data.serviceID = service_id + return data +end + +function commonAppServices.appServiceCapabilityUpdateParams(update_reason, manifest) + return { + systemCapability = { + systemCapabilityType = "APP_SERVICES", + appServicesCapabilities = { + appServices = { + commonAppServices.appServiceCapability(update_reason, manifest) + } + } + } + } +end + +function commonAppServices.getAppServiceConsumerConfig(app_id) + return { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = { "Base-4" , "AppServiceConsumer" }, + nicknames = { config["application" .. app_id].registerAppInterfaceParams.appName } + } +end + +function commonAppServices.getAppServiceProducerConfig(app_id, service_type) + local policy = { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = { "Base-4" , "AppServiceProvider" }, + nicknames = { config["application" .. app_id].registerAppInterfaceParams.appName }, + app_services = {} + } + local service_info = { + handled_rpcs = {{function_id = 2000}}, + service_names = { + config["application" .. app_id].registerAppInterfaceParams.appName + } + } + if service_type then + policy.app_services[service_type] = service_info + else + policy.app_services["MEDIA"] = service_info + end + return policy +end + +function commonAppServices.findCapabilityUpdate(capability, params) + if not params.systemCapability then + return false, "params.systemCapability is nil" + end + local systemCapability = params.systemCapability + if not systemCapability.systemCapabilityType == "APP_SERVICES" or not systemCapability.appServicesCapabilities then + return false, "appServicesCapabilities is nil" + end + local appServices = systemCapability.appServicesCapabilities.appServices + for key, value in pairs(appServices) do + local res, err = compareValues(capability, value, "params") + if res then + return true + end + end + return false, "unable to find matching app service update" +end + +function commonAppServices.publishEmbeddedAppService(manifest) + local cid = commonAppServices.getHMIConnection():SendRequest("AppService.PublishAppService", { + appServiceManifest = manifest + }) + local first_run = true + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated"):Times(AtLeast(1)):ValidIf(function(self, data) + if data.params.systemCapability.systemCapabilityType == "NAVIGATION" then + return true + elseif first_run then + first_run = false + local publishedParams = commonAppServices.appServiceCapability("PUBLISHED", manifest) + return commonAppServices.findCapabilityUpdate(publishedParams, data.params) + else + local activatedParams = commonAppServices.appServiceCapability("ACTIVATED", manifest) + return commonAppServices.findCapabilityUpdate(activatedParams, data.params) + end + end) + EXPECT_HMIRESPONSE(cid, { + result = { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true + }, + code = 0, + method = "AppService.PublishAppService" + } + }):Do(function(_, data) + if data.result.appServiceRecord then + serviceIDs[0] = data.result.appServiceRecord.serviceID + end + end) +end + +function commonAppServices.publishMobileAppService(manifest, app_id) + if not app_id then app_id = 1 end + local mobileSession = commonAppServices.getMobileSession(app_id) + local cid = mobileSession:SendRPC("PublishAppService", { + appServiceManifest = manifest + }) + + local first_run_mobile = true + mobileSession:ExpectNotification("OnSystemCapabilityUpdated"):Times(AtLeast(1)):ValidIf(function(self, data) + if first_run_mobile then + first_run_mobile = false + local publishedParams = commonAppServices.appServiceCapability("PUBLISHED", manifest) + return commonAppServices.findCapabilityUpdate(publishedParams, data.payload) + else + local activatedParams = commonAppServices.appServiceCapability("ACTIVATED", manifest) + return commonAppServices.findCapabilityUpdate(activatedParams, data.payload) + end + end) + local first_run_hmi = true + EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated"):Times(AtLeast(1)):ValidIf(function(self, data) + if data.params.systemCapability.systemCapabilityType == "NAVIGATION" then + return true + elseif first_run_hmi then + first_run_hmi = false + local publishedParams = commonAppServices.appServiceCapability("PUBLISHED", manifest) + return commonAppServices.findCapabilityUpdate(publishedParams, data.params) + else + local activatedParams = commonAppServices.appServiceCapability("ACTIVATED", manifest) + return commonAppServices.findCapabilityUpdate(activatedParams, data.params) + end + end) + + mobileSession:ExpectResponse(cid, { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true + }, + success = true, + resultCode = "SUCCESS" + }):Do(function(_, data) + if data.payload.success then + serviceIDs[app_id] = data.payload.appServiceRecord.serviceID + end + end) +end + +function commonAppServices.publishSecondMobileAppService(manifest1, manifest2, app_id) + if not app_id then app_id = 2 end + + local mobileSession = commonAppServices.getMobileSession(app_id) + local cid = mobileSession:SendRPC("PublishAppService", { + appServiceManifest = manifest2 + }) + + local second_app_record = commonAppServices.appServiceCapability("PUBLISHED", manifest2) + + local publishedParams = commonAppServices.appServiceCapabilityUpdateParams("ACTIVATED", manifest1) + publishedParams.systemCapability.appServicesCapabilities.appServices[2] = second_app_record + publishedParams.systemCapability.appServicesCapabilities.appServices[1].updateReason = nil + + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", publishedParams):Times(1) + mobileSession:ExpectResponse(cid, { + appServiceRecord = { + serviceManifest = manifest, + servicePublished = true + }, + success = true, + resultCode = "SUCCESS" + }):Do(function(_, data) + if data.payload.success then + serviceIDs[app_id] = data.payload.appServiceRecord.serviceID + end + end) +end + +function commonAppServices.mobileSubscribeAppServiceData(provider_app_id, service_type, app_id) + if not app_id then app_id = 1 end + if not service_type then service_type = "MEDIA" end + local requestParams = { + serviceType = service_type, + subscribe = true + } + local mobileSession = commonAppServices.getMobileSession(app_id) + local cid = mobileSession:SendRPC("GetAppServiceData", requestParams) + local service_id = commonAppServices.getAppServiceID(provider_app_id) + local responseParams = { + serviceData = commonAppServices.appServiceDataByType(service_id, service_type) + } + if provider_app_id == 0 then + EXPECT_HMICALL("AppService.GetAppServiceData", requestParams):Do(function(_, data) + commonAppServices.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) + end) + else + local providerMobileSession = commonAppServices.getMobileSession(provider_app_id) + + -- Fill out mobile response params + responseParams.resultCode = "SUCCESS" + responseParams.success = true + providerMobileSession:ExpectRequest("GetAppServiceData", requestParams):Do(function(_, data) + providerMobileSession:SendResponse("GetAppServiceData", data.rpcCorrelationId, responseParams) + end) + end + + mobileSession:ExpectResponse(cid, responseParams) +end + +function commonAppServices.getAppServiceID(app_id) + if not app_id then app_id = 1 end + return serviceIDs[app_id] +end + +function commonAppServices.GetAppServiceSystemCapability(manifest, subscribe, app_id) + if not app_id then app_id = 1 end + local requestParams = { + systemCapabilityType = "APP_SERVICES", + subscribe = subscribe + } + + local mobileSession = commonAppServices.getMobileSession(app_id) + local cid = mobileSession:SendRPC("GetSystemCapability", requestParams) + + local responseParams = { + success = true, + resultCode = "SUCCESS", + systemCapability = { + systemCapabilityType = "APP_SERVICES", + appServicesCapabilities = { + appServices = {{ + updatedAppServiceRecord = { + serviceManifest = manifest + } + }} + } + } + } + + mobileSession:ExpectResponse(cid, responseParams) +end + +function commonAppServices.cleanSession(app_id) + test.mobileSession[app_id]:StopRPC() + :Do(function(_, d) + utils.cprint(35, "Mobile session " .. d.sessionId .. " deleted") + test.mobileSession[app_id] = nil + end) + utils.wait() +end + +function commonAppServices.setValidateSchema(value) + config.ValidateSchema = value +end + +--[[ GetFile ]] + +local function file_check(file_name) + local file_found=io.open(file_name, "r") + return file_found~=nil +end + +local function getFileCRC32(fileName) + pFile = "files/"..fileName + local cmd = "cat " .. pFile .. " | gzip -1 | tail -c 8 | head -c 4" + local handle = io.popen(cmd) + local crc = handle:read("*a") + handle:close() + local function bytesToInt(pStr) + local t = { string.byte(pStr, 1, -1) } + local n = 0 + for k = 1, #t do + n = n + t[k] * 2 ^ ((k - 1) * 8) + end + return n + end + return bytesToInt(crc) +end + +local function getATFPath() + local handle = io.popen("echo $(pwd)") + local result = handle:read("*a") + handle:close() + return result:sub(0, -2) +end + +function commonAppServices.getFileFromStorage(app_id, request_params, response_params) + local mobileSession = commonAppServices.getMobileSession(app_id) + if file_check("files/"..request_params.fileName) and response_params.crc == nil then + local file_crc = getFileCRC32(request_params.fileName) + if response_params.success then + response_params.crc = file_crc + end + end + --mobile side: sending GetFile request + local cid = mobileSession:SendRPC("GetFile", request_params) + --mobile side: expected GetFile response + mobileSession:ExpectResponse(cid, response_params) +end + +function commonAppServices.getFileFromService(app_id, asp_app_id, request_params, response_params) + local mobileSession = commonAppServices.getMobileSession(app_id) + if file_check("files/"..request_params.fileName) and response_params.crc == nil then + local file_crc = getFileCRC32(request_params.fileName) + if response_params.success then + response_params.crc = file_crc + end + end + + request_params.appServiceId = commonAppServices.getAppServiceID(asp_app_id) + + --mobile side: sending GetFile request + local cid = mobileSession:SendRPC("GetFile", request_params) + if asp_app_id == 0 then + --EXPECT_HMICALL + commonAppServices.getHMIConnection():ExpectRequest("BasicCommunication.GetFilePath") + :Do(function(_, d2) + local cwd = getATFPath() + file_path = cwd.."/files/"..request_params.fileName + commonAppServices.getHMIConnection():SendResponse(d2.id, d2.method, "SUCCESS", {filePath = file_path}) + end) + end + + --mobile side: expected GetFile response + mobileSession:ExpectResponse(cid, response_params) +end + +function commonAppServices.putFileInStorage(app_id, request_params, response_params) + local mobileSession = commonAppServices.getMobileSession(app_id) + --mobile side: sending PutFile request + local cid = mobileSession:SendRPC("PutFile", request_params, "files/"..request_params.syncFileName) + --mobile side: expected PutFile response + mobileSession:ExpectResponse(cid, response_params) +end + +--[[Timeout]] +function commonAppServices.getRpcPassThroughTimeoutFromINI() + local SDLini = config.pathToSDL .. tostring("smartDeviceLink.ini") + f = assert(io.open(SDLini, "r")) + local fileContentUpdated = false + local fileContent = f:read("*all") + local property = fileContent:match('RpcPassThroughTimeout%s*=%s*[a-zA-Z%/0-9%_.]+[^\n]') + local RpcPassThroughTimeout = string.gsub(property:match("=.*"), "=", "") + return tonumber(RpcPassThroughTimeout) +end + +function commonAppServices:Request_PTU() + local is_test_fail = false + local hmi_app1_id = config.application1.registerAppInterfaceParams.appName + commonAppServices.getHMIConnection():SendNotification("SDL.OnPolicyUpdate", {} ) + EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UPDATE_NEEDED"}) + + EXPECT_HMICALL("BasicCommunication.PolicyUpdate",{ file = "/tmp/fs/mp/images/ivsu_cache/sdl_snapshot.json" }) + :Do(function(_,data) + commonAppServices.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) +end + +function commonAppServices.GetPolicySnapshot() + return utils.jsonFileToTable("/tmp/fs/mp/images/ivsu_cache/sdl_snapshot.json") +end + +function commonAppServices.test_assert(condition, msg) + if not condition then + test:FailTestCase(msg) + end +end + + +return commonAppServices diff --git a/test_scripts/CloudAppRPCs/001_CloupAppVehicleId_GetVehicleData.lua b/test_scripts/CloudAppRPCs/001_CloupAppVehicleId_GetVehicleData.lua new file mode 100644 index 0000000000..c6274dd650 --- /dev/null +++ b/test_scripts/CloudAppRPCs/001_CloupAppVehicleId_GetVehicleData.lua @@ -0,0 +1,64 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetVehicleData +-- +-- Steps: +-- 1) Application sends a GetVehicleData request with the param cloudAppVehicleID +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +-- cloudAppVehicleID = +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc = { + name = "GetVehicleData", + params = { + cloudAppVehicleID = true + } +} + +local vehicleDataValues = { + cloudAppVehicleID = "cXv9689o" +} + +--[[ Local Functions ]] +local function processRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + EXPECT_HMICALL("VehicleInfo." .. rpc.name, rpc.params) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", vehicleDataValues ) + end) + local responseParams = vehicleDataValues + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name, processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/CloudAppRPCs/002_CloudAppVehicleId_SubscribeVehicleData.lua b/test_scripts/CloudAppRPCs/002_CloudAppVehicleId_SubscribeVehicleData.lua new file mode 100644 index 0000000000..46333f1cf9 --- /dev/null +++ b/test_scripts/CloudAppRPCs/002_CloudAppVehicleId_SubscribeVehicleData.lua @@ -0,0 +1,68 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetVehicleData +-- +-- Steps: +-- 1) Application sends a SubscribeVehicleData request with the param cloudAppVehicleID +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +-- dataType = "VEHICLEDATA_CLOUDAPPVEHICLEID" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc = { + name = "SubscribeVehicleData", + params = { + cloudAppVehicleID = true + } +} + +local vehicleDataResults = { + cloudAppVehicleID = { + dataType = "VEHICLEDATA_CLOUDAPPVEHICLEID", + resultCode = "SUCCESS" + } +} + +--[[ Local Functions ]] +local function processRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + EXPECT_HMICALL("VehicleInfo." .. rpc.name, rpc.params) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + vehicleDataResults) + end) + local responseParams = vehicleDataResults + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name, processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/CloudAppRPCs/003_CloudAppVehicleId_UnsubscribeVehicleData.lua b/test_scripts/CloudAppRPCs/003_CloudAppVehicleId_UnsubscribeVehicleData.lua new file mode 100644 index 0000000000..03515dea55 --- /dev/null +++ b/test_scripts/CloudAppRPCs/003_CloudAppVehicleId_UnsubscribeVehicleData.lua @@ -0,0 +1,90 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetVehicleData +-- +-- Steps: +-- 1) Application sends a SubscribeVehicleData request with the param cloudAppVehicleID +-- 2) Application sends an UnsubscribeVehicleData request with the param cloudAppVehicleID +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +-- dataType = "VEHICLEDATA_CLOUDAPPVEHICLEID" +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc_subscribe = { + name = "SubscribeVehicleData", + params = { + cloudAppVehicleID = true + } +} + +local rpc_unsubscribe = { + name = "UnsubscribeVehicleData", + params = { + cloudAppVehicleID = true + } +} + +local vehicleDataResults = { + cloudAppVehicleID = { + dataType = "VEHICLEDATA_CLOUDAPPVEHICLEID", + resultCode = "SUCCESS" + } +} + +--[[ Local Functions ]] +local function processRPCSubscribeSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc_subscribe.name, rpc_subscribe.params) + EXPECT_HMICALL("VehicleInfo." .. rpc_subscribe.name, rpc_subscribe.params) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + vehicleDataResults) + end) + local responseParams = vehicleDataResults + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function processRPCUnsubscribeSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc_unsubscribe.name, rpc_unsubscribe.params) + EXPECT_HMICALL("VehicleInfo." .. rpc_unsubscribe.name, rpc_unsubscribe.params) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + vehicleDataResults) + end) + local responseParams = vehicleDataResults + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc_subscribe.name, processRPCSubscribeSuccess) +runner.Step("RPC " .. rpc_unsubscribe.name, processRPCUnsubscribeSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/CloudAppRPCs/004_CloudAppVehicleId_OnVehicleData.lua b/test_scripts/CloudAppRPCs/004_CloudAppVehicleId_OnVehicleData.lua new file mode 100644 index 0000000000..5c578078fd --- /dev/null +++ b/test_scripts/CloudAppRPCs/004_CloudAppVehicleId_OnVehicleData.lua @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetVehicleData +-- +-- Steps: +-- 1) Application sends a SubscribeVehicleData request with the param cloudAppVehicleID +-- 2) Application receives an OnVehicleData when the cloudAppVehicleID is updated +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +-- dataType = "VEHICLEDATA_CLOUDAPPVEHICLEID" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc1 = { + name = "SubscribeVehicleData", + params = { + cloudAppVehicleID = true + } +} + +local rpc2 = { + name = "OnVehicleData", + params = { + cloudAppVehicleID = "cxV96989o" + } +} + +local vehicleDataResults = { + cloudAppVehicleID = { + dataType = "VEHICLEDATA_CLOUDAPPVEHICLEID", + resultCode = "SUCCESS" + } +} + +--[[ Local Functions ]] +local function processRPCSubscribeSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc1.name, rpc1.params) + EXPECT_HMICALL("VehicleInfo." .. rpc1.name, rpc1.params) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", vehicleDataResults) + end) + + local responseParams = vehicleDataResults + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function checkNotificationSuccess() + local mobileSession = common.getMobileSession(1) + common.getHMIConnection():SendNotification("VehicleInfo." .. rpc2.name, rpc2.params) + mobileSession:ExpectNotification("OnVehicleData", rpc2.params) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc1.name, processRPCSubscribeSuccess) +runner.Step("RPC " .. rpc2.name, checkNotificationSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/CloudAppRPCs/005_SetCloudAppProperties_Success.lua b/test_scripts/CloudAppRPCs/005_SetCloudAppProperties_Success.lua new file mode 100644 index 0000000000..ca1e983eb9 --- /dev/null +++ b/test_scripts/CloudAppRPCs/005_SetCloudAppProperties_Success.lua @@ -0,0 +1,103 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with SetCloudAppProperties +-- +-- Steps: +-- 1) Application sends a SetCloudAppProperties RPC request +-- 2) Application triggers a PTU +-- 3) Checks policy table to make sure cloud app properties are set correctly +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +-- 2) VerifyCloudAppProperties succeeds +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') +local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc = { + name = "SetCloudAppProperties", + params = { + properties = { + nicknames = { "TestApp" }, + appID = "0000001", + enabled = true, + authToken = "ABCD12345", + cloudTransportType = "WSS", + hybridAppPreference = "CLOUD", + endpoint = "ws://127.0.0.1:8080/" + } + } +} +local expected = { + nicknames = { "TestApp" }, + auth_token = "ABCD12345", + cloud_transport_type = "WSS", + enabled = "true", + hybrid_app_preference = "CLOUD", + endpoint = "ws://127.0.0.1:8080/" +} + +--[[ Local Functions ]] +local function processRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + local responseParams = {} + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function verifyCloudAppProperties() + local snp_tbl = common.GetPolicySnapshot() + local app_id = rpc.params.properties.appID + local result = {} + + result.nicknames = snp_tbl.policy_table.app_policies[app_id].nicknames + common.test_assert(commonFunctions:is_table_equal(result.nicknames, expected.nicknames), "Incorrect nicknames") + + result.auth_token = snp_tbl.policy_table.app_policies[app_id].auth_token + common.test_assert(result.auth_token == expected.auth_token, "Incorrect auth token value") + + result.cloud_transport_type = snp_tbl.policy_table.app_policies[app_id].cloud_transport_type + common.test_assert(result.cloud_transport_type == expected.cloud_transport_type, "Incorrect cloud_transport_type value") + + result.enabled = tostring(snp_tbl.policy_table.app_policies[app_id].enabled) + common.test_assert(result.enabled == expected.enabled, "Incorrect enabled value") + + result.hybrid_app_preference = snp_tbl.policy_table.app_policies[app_id].hybrid_app_preference + common.test_assert(result.hybrid_app_preference == expected.hybrid_app_preference, "Incorrect hybrid_app_preference value") + + result.endpoint = snp_tbl.policy_table.app_policies[app_id].endpoint + common.test_assert(result.endpoint == expected.endpoint, "Incorrect endpoint") +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppStoreConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS", processRPCSuccess) +runner.Step("Request PTU", common.Request_PTU) +runner.Step("Verify CloudApp Properties", verifyCloudAppProperties) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/CloudAppRPCs/006_SetCloudAppProperties_InvalidParams.lua b/test_scripts/CloudAppRPCs/006_SetCloudAppProperties_InvalidParams.lua new file mode 100644 index 0000000000..469e040bc5 --- /dev/null +++ b/test_scripts/CloudAppRPCs/006_SetCloudAppProperties_InvalidParams.lua @@ -0,0 +1,65 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with SetCloudAppProperties +-- +-- Steps: +-- 1) Application sends a SetCloudAppProperties RPC request(with invalid param) +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: INVALID_DATA, +-- success: false +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc = { + name = "SetCloudAppProperties", + params = { + properties = { + nicknames = { "TestApp" }, + appID = "0000001", + enabled = true, + authToken = "ABCD12345", + cloudTransportType = "WSS", + hybridAppPreference = "CORE", + endpoint = "ws://127.0.0.1:8080/" + } + } +} + + +--[[ Local Functions ]] +local function processRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + local responseParams = {} + responseParams.success = false + responseParams.resultCode = "INVALID_DATA" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppStoreConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_INVALID_DATA", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/CloudAppRPCs/007_SetCloudAppProperties_InitNewCloudApp.lua b/test_scripts/CloudAppRPCs/007_SetCloudAppProperties_InitNewCloudApp.lua new file mode 100644 index 0000000000..6eaa78d74e --- /dev/null +++ b/test_scripts/CloudAppRPCs/007_SetCloudAppProperties_InitNewCloudApp.lua @@ -0,0 +1,104 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with SetCloudAppProperties +-- +-- Steps: +-- 1) Application sends a SetCloudAppProperties RPC request(with app_id which does not currently exist in policy table) +-- 2) Application triggers a PTU +-- 3) Checks policy table to make sure cloud app properties are set correctly +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +-- 2) VerifyCloudAppProperties succeeds +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') +local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local rpc = { + name = "SetCloudAppProperties", + params = { + properties = { + nicknames = { "TestApp" }, + appID = "232", + enabled = true, + authToken = "ABCD12345", + cloudTransportType = "WSS", + hybridAppPreference = "CLOUD", + endpoint = "ws://127.0.0.1:8080/" + } + } +} +local expected = { + nicknames = { "TestApp" }, + auth_token = "ABCD12345", + cloud_transport_type = "WSS", + enabled = "true", + hybrid_app_preference = "CLOUD", + endpoint = "ws://127.0.0.1:8080/" +} + +--[[ Local Functions ]] +local function processRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params) + + local responseParams = {} + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function verifyCloudAppProperties() + local snp_tbl = common.GetPolicySnapshot() + local app_id = rpc.params.properties.appID + local result = {} + + result.nicknames = snp_tbl.policy_table.app_policies[app_id].nicknames + common.test_assert(commonFunctions:is_table_equal(result.nicknames, expected.nicknames), "Incorrect nicknames") + + result.auth_token = snp_tbl.policy_table.app_policies[app_id].auth_token + common.test_assert(result.auth_token == expected.auth_token, "Incorrect auth token value") + + result.cloud_transport_type = snp_tbl.policy_table.app_policies[app_id].cloud_transport_type + common.test_assert(result.cloud_transport_type == expected.cloud_transport_type, "Incorrect cloud_transport_type value") + + result.enabled = tostring(snp_tbl.policy_table.app_policies[app_id].enabled) + common.test_assert(result.enabled == expected.enabled, "Incorrect enabled value") + + result.hybrid_app_preference = snp_tbl.policy_table.app_policies[app_id].hybrid_app_preference + common.test_assert(result.hybrid_app_preference == expected.hybrid_app_preference, "Incorrect hybrid_app_preference value") + + result.endpoint = snp_tbl.policy_table.app_policies[app_id].endpoint + common.test_assert(result.endpoint == expected.endpoint, "Incorrect endpoint") +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppStoreConfig(1); +end + + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. rpc.name .. "_resultCode_SUCCESS(new_app_id)", processRPCSuccess) +runner.Step("Request PTU", common.Request_PTU) +runner.Step("Verify CloudApp Properties", verifyCloudAppProperties) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/CloudAppRPCs/008_GetCloudAppProperties_Success.lua b/test_scripts/CloudAppRPCs/008_GetCloudAppProperties_Success.lua new file mode 100644 index 0000000000..262b3bcee2 --- /dev/null +++ b/test_scripts/CloudAppRPCs/008_GetCloudAppProperties_Success.lua @@ -0,0 +1,82 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetCloudAppProperties +-- +-- Steps: +-- 1) Application triggers a PTU with cloud app information present +-- 2) Application sends a GetCloudAppProperties RPC request with the correct cloud app id +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') +local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local get_rpc = { + name = "GetCloudAppProperties", + params = { + appID = "232" + } +} + +local get_expected = { + nicknames = { "TestApp" }, + authToken = "ABCD12345", + cloudTransportType = "WSS", + enabled = true, + hybridAppPreference = "CLOUD", + endpoint = "ws://127.0.0.1:8080/" +} + +--[[ Local Functions ]] +local function processGetRPCSuccess() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(get_rpc.name, get_rpc.params) + + local responseParams = {} + responseParams.success = true + responseParams.resultCode = "SUCCESS" + responseParams.properties = get_expected + mobileSession:ExpectResponse(cid, responseParams) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppStoreConfig(1); + tbl.policy_table.app_policies[get_rpc.params.appID] = { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = { "Base-4" }, + nicknames = { "TestApp" }, + enabled = true, + auth_token = "ABCD12345", + cloud_transport_type = "WSS", + hybrid_app_preference = "CLOUD", + endpoint = "ws://127.0.0.1:8080/" + }; +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. get_rpc.name .. "_resultCode_SUCCESS", processGetRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/CloudAppRPCs/009_GetCloudAppProperties_DATA_NOT_AVAILABLE.lua b/test_scripts/CloudAppRPCs/009_GetCloudAppProperties_DATA_NOT_AVAILABLE.lua new file mode 100644 index 0000000000..be697bdac8 --- /dev/null +++ b/test_scripts/CloudAppRPCs/009_GetCloudAppProperties_DATA_NOT_AVAILABLE.lua @@ -0,0 +1,60 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for with GetCloudAppProperties +-- +-- Steps: +-- 1) Application triggers a PTU with cloud app information present +-- 2) Application sends a GetCloudAppProperties RPC request with the wrong app id +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: DATA_NOT_AVAILABLE, +-- success: false +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') +local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local get_rpc = { + name = "GetCloudAppProperties", + params = { + appID = "231" + } +} + +--[[ Local Functions ]] + +local function processGetRPCFailure() + local mobileSession = common.getMobileSession(1) + local cid = mobileSession:SendRPC(get_rpc.name, get_rpc.params) + + local responseParams = {} + responseParams.success = false + responseParams.resultCode = "DATA_NOT_AVAILABLE" + mobileSession:ExpectResponse(cid, responseParams) +end + +local function PTUfunc(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getCloudAppStoreConfig(1); +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("RPC " .. get_rpc.name .. "_resultCode_DATA_NOT_AVAILABLE", processGetRPCFailure) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/CloudAppRPCs/010_get_icon_url.lua b/test_scripts/CloudAppRPCs/010_get_icon_url.lua new file mode 100644 index 0000000000..52ee3140fd --- /dev/null +++ b/test_scripts/CloudAppRPCs/010_get_icon_url.lua @@ -0,0 +1,93 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for a cloud app with an icon_url +-- +-- Steps: +-- 1) Core sends a systemRequest type = ICONURL +-- 2) Mobile responds with image data in a SystemRequest ICON_URL +-- +-- Expected: +-- 1) SDL responds to mobile app with "ResultCode: SUCCESS, +-- success: true +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + + --[[ Test Configuration ]] + runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local cloud_app_id = "cloudAppID123" +local url = "https://fakeurl1234512345.com" +local icon_image_path = "files/icon.png" +config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 5 +config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 1 + +local rpc = { + name = "SystemRequest", + params = { + requestType = "ICON_URL", fileName = url + } +} + +--[[ Local Functions ]] +local function PTUfunc(tbl) + params = { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = {"Base-4"}, + RequestType = {}, + RequestSubType = {}, + hybrid_app_preference = "CLOUD", + endpoint = "ws://192.168.1.1:3000/", + enabled = true, + cloud_transport_type = "WS", + icon_url = url, + nicknames = {"CloudApp"} + } + tbl.policy_table.app_policies[cloud_app_id] = params +end + +local function processRPCSuccess() + local mobileSession = common.getMobileSession(self, 1) + local cid = mobileSession:SendRPC(rpc.name, rpc.params, icon_image_path) + EXPECT_HMICALL("BasicCommunication.UpdateAppList"):Times(AtLeast(1)) + :ValidIf(function(self, data) + if data.params == nil then + return false + end + if data.params.applications[1] == nil and data.params.applications[2] == nil then + return false + end + return data.params.applications[1].icon ~= nil or data.params.applications[2].icon ~= nil + end) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS") + end) + local responseParams = {} + responseParams.success = true + responseParams.resultCode = "SUCCESS" + mobileSession:ExpectResponse(cid, responseParams) + end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Delete Storage", common.DeleteStorageFolder) + +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdateWithIconUrl, { PTUfunc, nil, url }) + +runner.Step("Send App Icon SystemRequest", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) +runner.Step("Delete Storage", common.DeleteStorageFolder) diff --git a/test_scripts/CloudAppRPCs/011_UpdateAppList_NewCloudApplication.lua b/test_scripts/CloudAppRPCs/011_UpdateAppList_NewCloudApplication.lua new file mode 100644 index 0000000000..cdd3088452 --- /dev/null +++ b/test_scripts/CloudAppRPCs/011_UpdateAppList_NewCloudApplication.lua @@ -0,0 +1,55 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- +-- Steps: +-- 1) Application triggers a PTU which includes a new enabled cloud application +-- +-- Expected: +-- 1) SDL sends an UpdateAppList message with the new cloud application +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local appID = config.application2.registerAppInterfaceParams.fullAppID + +local function updatePTU(tbl) + tbl.policy_table.app_policies[appID] = common.getCloudAppConfig(2) +end + +local function checkUpdateAppList(self) + EXPECT_HMINOTIFICATION("BasicCommunication.UpdateAppList"):Times(AtLeast(1)) + :ValidIf(function(_,data) + if #data.params.applications ~= 0 then + for i=1,#data.params.applications do + local app = data.params.applications[i] + if app.policyAppID == appID then + return app.isCloudApplication and app.cloudConnectionStatus == "NOT_CONNECTED" + end + end + print(" \27[36m Application was not found in application array \27[0m") + else + print(" \27[36m Application array in BasicCommunication.UpdateAppList was empty \27[0m") + end + return false + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerAppWOPTU, { 1 }) + +runner.Title("Test") +runner.Step("Check UpdateAppList", common.policyTableUpdate, { updatePTU, checkUpdateAppList }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) + diff --git a/test_scripts/CloudAppRPCs/commonCloudAppRPCs.lua b/test_scripts/CloudAppRPCs/commonCloudAppRPCs.lua new file mode 100644 index 0000000000..2443744554 --- /dev/null +++ b/test_scripts/CloudAppRPCs/commonCloudAppRPCs.lua @@ -0,0 +1,184 @@ +local actions = require("user_modules/sequences/actions") +local json = require("modules/json") +local test = require("user_modules/dummy_connecttest") +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") +local commonSteps = require("user_modules/shared_testcases/commonSteps") +local utils = require("user_modules/utils") +local events = require("events") + +local commonCloudAppRPCs = actions + +local function jsonFileToTable(file_name) + local f = io.open(file_name, "r") + local content = f:read("*all") + f:close() + return json.decode(content) +end + +function commonCloudAppRPCs.getCloudAppConfig(app_id) + return { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = { "Base-4" , "CloudApp" }, + endpoint = "ws://127.0.0.1:2000/", + nicknames = { config["application" .. app_id].registerAppInterfaceParams.appName }, + cloud_transport_type = "WS", + enabled = true + } +end + +function commonCloudAppRPCs.getCloudAppStoreConfig() + return { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = { "Base-4" , "CloudAppStore" } + } +end + +function commonCloudAppRPCs:Request_PTU() + local is_test_fail = false + local hmi_app1_id = config.application1.registerAppInterfaceParams.appName + commonCloudAppRPCs.getHMIConnection():SendNotification("SDL.OnPolicyUpdate", {} ) + EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UPDATE_NEEDED"}) + + EXPECT_HMICALL("BasicCommunication.PolicyUpdate",{ file = "/tmp/fs/mp/images/ivsu_cache/sdl_snapshot.json" }) + :Do(function(_,data) + commonCloudAppRPCs.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) +end + +function commonCloudAppRPCs.test_assert(condition, msg) + if not condition then + test:FailTestCase(msg) + end +end + +function commonCloudAppRPCs.GetPolicySnapshot() + return jsonFileToTable("/tmp/fs/mp/images/ivsu_cache/sdl_snapshot.json") +end + +function commonCloudAppRPCs:Directory_exist(DirectoryPath) + if type( DirectoryPath ) ~= 'string' then + error('Directory_exist : Input parameter is not string : ' .. type(DirectoryPath) ) + return false + else + local response = os.execute( 'cd ' .. DirectoryPath .. " 2> /dev/null" ) + -- ATf returns as result of 'os.execute' boolean value, lua interp returns code. if conditions process result as for lua enterp and for ATF. + if response == nil or response == false then + return false + end + if response == true then + return true + end + return response == 0; + end +end + +function commonCloudAppRPCs.DeleteStorageFolder() + local ExistDirectoryResult = commonCloudAppRPCs:Directory_exist( tostring(config.pathToSDL .. "storage")) + if ExistDirectoryResult == true then + local RmFolder = assert( os.execute( "rm -rf " .. tostring(config.pathToSDL .. "storage" ))) + if RmFolder ~= true then + print("Folder 'storage' is not deleted") + end + else + print("Folder 'storage' is absent") + end +end + +local function getPTUFromPTS() + local pTbl = {} + local ptsFileName = commonFunctions:read_parameter_from_smart_device_link_ini("SystemFilesPath") .. "/" + .. commonFunctions:read_parameter_from_smart_device_link_ini("PathToSnapshot") + if utils.isFileExist(ptsFileName) then + pTbl = utils.jsonFileToTable(ptsFileName) + else + utils.cprint(35, "PTS file was not found, PreloadedPT is used instead") + local appConfigFolder = commonFunctions:read_parameter_from_smart_device_link_ini("AppConfigFolder") + if appConfigFolder == nil or appConfigFolder == "" then + appConfigFolder = commonPreconditions:GetPathToSDL() + end + local preloadedPT = commonFunctions:read_parameter_from_smart_device_link_ini("PreloadedPT") + local ptsFile = appConfigFolder .. preloadedPT + if utils.isFileExist(ptsFile) then + pTbl = utils.jsonFileToTable(ptsFile) + else + utils.cprint(35, "PreloadedPT was not found, PTS is not created") + end + end + if next(pTbl) ~= nil then + pTbl.policy_table.consumer_friendly_messages.messages = nil + pTbl.policy_table.device_data = nil + pTbl.policy_table.module_meta = nil + pTbl.policy_table.usage_and_error_counts = nil + pTbl.policy_table.functional_groupings["DataConsent-2"].rpcs = json.null + pTbl.policy_table.module_config.preloaded_pt = nil + pTbl.policy_table.module_config.preloaded_date = nil + end + return pTbl +end + +function commonCloudAppRPCs.policyTableUpdateWithIconUrl(pPTUpdateFunc, pExpNotificationFunc, url) + if pExpNotificationFunc then + pExpNotificationFunc() + end + local ptsFileName = commonFunctions:read_parameter_from_smart_device_link_ini("SystemFilesPath") .. "/" + .. commonFunctions:read_parameter_from_smart_device_link_ini("PathToSnapshot") + local ptuFileName = os.tmpname() + local requestId = commonCloudAppRPCs.getHMIConnection():SendRequest("SDL.GetURLS", { service = 7 }) + commonCloudAppRPCs.getHMIConnection():ExpectResponse(requestId) + :Do(function() + commonCloudAppRPCs.getHMIConnection():SendNotification("BasicCommunication.OnSystemRequest", + { requestType = "PROPRIETARY", fileName = ptsFileName }) + local ptuTable = getPTUFromPTS() + for i = 1, commonCloudAppRPCs.getAppsCount() do + ptuTable.policy_table.app_policies[commonCloudAppRPCs.getConfigAppParams(i).fullAppID] = commonCloudAppRPCs.getAppDataForPTU(i) + end + if pPTUpdateFunc then + pPTUpdateFunc(ptuTable) + end + utils.tableToJsonFile(ptuTable, ptuFileName) + local event = events.Event() + event.matches = function(e1, e2) return e1 == e2 end + commonCloudAppRPCs.getHMIConnection():ExpectEvent(event, "PTU event") + for id = 1, commonCloudAppRPCs.getAppsCount() do + commonCloudAppRPCs.getMobileSession(id):ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY"}, {requestType = "ICON_URL" }) + :ValidIf(function(self, data) + if data.payload.requestType == "PROPRIETARY" then + return true + end + if data.payload.requestType == "ICON_URL" and data.payload.url == url then + return true + end + return false + end) + :Do(function(_, data) + if data.payload.requestType == "PROPRIETARY" then + if not pExpNotificationFunc then + commonCloudAppRPCs.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) + commonCloudAppRPCs.getHMIConnection():ExpectNotification("SDL.OnStatusUpdate", { status = "UP_TO_DATE" }) + end + utils.cprint(35, "App ".. id .. " was used for PTU") + commonCloudAppRPCs.getHMIConnection():RaiseEvent(event, "PTU event") + local corIdSystemRequest = commonCloudAppRPCs.getMobileSession(id):SendRPC("SystemRequest", { + requestType = "PROPRIETARY" }, ptuFileName) + commonCloudAppRPCs.getHMIConnection():ExpectRequest("BasicCommunication.SystemRequest") + :Do(function(_, d3) + commonCloudAppRPCs.getHMIConnection():SendResponse(d3.id, "BasicCommunication.SystemRequest", "SUCCESS", { }) + commonCloudAppRPCs.getHMIConnection():SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = d3.params.fileName }) + end) + commonCloudAppRPCs.getMobileSession(id):ExpectResponse(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) + :Do(function() + os.remove(ptuFileName) end) + end + end) + :Times(AtMost(2)) + end + end) +end + +return commonCloudAppRPCs diff --git a/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua b/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua index 59292cb7da..04f0a5d157 100644 --- a/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua +++ b/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua @@ -343,18 +343,18 @@ local function PerformInteractionVR(params, self) local RequestTime local RespTime local TimeBetweenReqRes - local TimeToResponseForVR = 2000 - local RespTimeout = params.timeout + local TimeToResponseForUI = 2000 + local RespTimeout = DefaultTimeout + params.timeout local cid = self.mobileSession1:SendRPC("PerformInteraction", params) RequestTime = timestamp() - EXPECT_HMICALL("VR.PerformInteraction") + EXPECT_HMICALL("UI.PerformInteraction") :Do(function(_,data) - local function RespVR() + local function RespUI() self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) end - RUN_AFTER(RespVR, TimeToResponseForVR) + RUN_AFTER(RespUI, TimeToResponseForUI) end) - EXPECT_HMICALL("UI.PerformInteraction") + EXPECT_HMICALL("VR.PerformInteraction") self.mobileSession1:ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) :Timeout(RespTimeout + 1000) :ValidIf(function() diff --git a/test_scripts/Defects/5_0/2427_policy_db_consistency_after_ignition_cycle.lua b/test_scripts/Defects/5_0/2427_policy_db_consistency_after_ignition_cycle.lua new file mode 100644 index 0000000000..926caa893a --- /dev/null +++ b/test_scripts/Defects/5_0/2427_policy_db_consistency_after_ignition_cycle.lua @@ -0,0 +1,109 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2427 +--------------------------------- +--[[ Required Shared libraries ]] +local common = require("user_modules/sequences/actions") +local runner = require('user_modules/script_runner') +local utils = require("user_modules/utils") +local SDL = require('SDL') +local test = require("user_modules/dummy_connecttest") +local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') +local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.defaultProtocolVersion = 2 +config.ExitOnCrash = false + +--[[ Local Variables ]] +local expNumOfRecords + +--[[ Local Functions ]] +local function execCMD(pCmd) + local handle = io.popen(pCmd) + local result = handle:read("*a") + handle:close() + return result +end + +local function waitUntilSDLLoggerIsClosed() + utils.cprint(35, "Wait until SDL Logger is closed ...") + local function getNetStat() + local cmd = "netstat" + .. " | grep -E '" .. config.sdl_logs_host .. ":" .. config.sdl_logs_port .. "\\s*FIN_WAIT'" + .. " | wc -l" + return tonumber(execCMD(cmd)) + end + while getNetStat() > 0 do + os.execute("sleep 1") + end + os.execute("sleep 1") +end + +local function cleanSessions() + for i = 1, common.getAppsCount() do + test.mobileSession[i] = nil + utils.cprint(35, "Mobile session " .. i .. " deleted") + end + common.getMobileConnection():Close() + utils.wait() +end + +local function getDataFromPolicyDB() + local db = commonPreconditions:GetPathToSDL() .. "storage/policy.sqlite" + local query = "select count(*) from application" + local result = commonFunctions:get_data_policy_sql(db, query) + return tostring(result[1]) +end + +local function ignitionOff() + expNumOfRecords = getDataFromPolicyDB() + common.getHMIConnection():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "SUSPEND" }) + common.getHMIConnection():ExpectNotification("BasicCommunication.OnSDLPersistenceComplete") + :Do(function() + common.getHMIConnection():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "IGNITION_OFF" }) + common.getMobileSession():ExpectNotification("OnAppInterfaceUnregistered", { reason = "IGNITION_OFF" }) + end) + common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = false }) + common.getHMIConnection():ExpectNotification("BasicCommunication.OnSDLClose") + :Do(function() + local isSDLStoppedByItself = true + local count = 0 + while SDL:CheckStatusSDL() == SDL.RUNNING do + count = count + 1 + if count == 10 then + SDL:StopSDL() + waitUntilSDLLoggerIsClosed() + isSDLStoppedByItself = false + end + os.execute("sleep 1") + end + if not isSDLStoppedByItself then + utils.cprint(31, "SDL was not stopped") + end + cleanSessions() + end) +end + +local function checkDataInPolicyDB() + local actNumOfRecords = getDataFromPolicyDB() + if actNumOfRecords ~= expNumOfRecords then + test:FailTestCase("Policy DB was corrupted: expected '" .. expNumOfRecords + .. "' records in 'application' table, actual '" .. actNumOfRecords .. "'") + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Wait", utils.wait) + +runner.Title("Test") +runner.Step("Send Ignition Off", ignitionOff) +runner.Step("Start new Ignition Cycle", common.start) +runner.Step("Check Policy DB", checkDataInPolicyDB) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/5_1/2862_SDL_sends_UnsubscribeWayPoint_request_to_HMI.lua b/test_scripts/Defects/5_1/2862_SDL_sends_UnsubscribeWayPoint_request_to_HMI.lua new file mode 100644 index 0000000000..fb46bff3c2 --- /dev/null +++ b/test_scripts/Defects/5_1/2862_SDL_sends_UnsubscribeWayPoint_request_to_HMI.lua @@ -0,0 +1,101 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_core/issues/2862 +-- Description: +-- SDL sends UnsubscribeWayPoint request to HMI for App1 when App2 is still subscribed to the WayPoint +-- Precondition: +-- 1) SDL and HMI are started +-- 2) App1 and App2 are registered +-- 3) App1 and App2 are subscribed to SubscribeWayPoint +-- +-- Steps: +-- 1) App1 requests the UnsubscribeWayPoint +-- 2) App2 requests the UnsubscribeWayPoint +-- +-- Expected: +-- 1) SDL does not transfer the request to HMI, unsubscribes internally and responds with result code SUCCESS, success: true for App1 +-- 2) SDL sends the request to HMI for app2 and unsubscribes after successful HMI response +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local variables ]] +sub_list = {} + +subscribeRPC = { + name = "SubscribeWayPoints", + hmi_name = "Navigation.SubscribeWayPoints", + params = {}, + result = { success = true } +} + +unsubscribeRPC = { + name = "UnsubscribeWayPoints", + hmi_name = "Navigation.UnsubscribeWayPoints", + params = {}, + result = { success = true } +} + +--[[ Local functions ]] +local function PTUfunc(tbl) + pt_entry = common.getAppDataForPTU(1) + pt_entry.groups = { "Base-4" , "WayPoints" } + tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = pt_entry + pt_entry = common.getAppDataForPTU(2) + pt_entry.groups = { "Base-4" , "WayPoints" } + tbl.policy_table.app_policies[common.getConfigAppParams(2).fullAppID] = pt_entry +end + +local function SubscribeWayPoints(app_id) + if app_id == nil then app_id = 1 end + local mobileSession = common.getMobileSession(app_id) + local cid = mobileSession:SendRPC(subscribeRPC.name, subscribeRPC.params) + + if #sub_list == 0 then + --Expect HMI call for the first app which sends a SubscribeWayPoints request + EXPECT_HMICALL(subscribeRPC.hmi_name, nil):Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) + end + + table.insert(sub_list, app_id) + mobileSession:ExpectResponse(cid, subscribeRPC.result) +end + +local function UnsubscribeWayPoints(app_id) + if app_id == nil then app_id = 1 end + local mobileSession = common.getMobileSession(app_id) + local cid = mobileSession:SendRPC(unsubscribeRPC.name, unsubscribeRPC.params) + + if #sub_list == 1 then + --Expect HMI call for the last app which sends a UnsubscribeWayPoints request + EXPECT_HMICALL(unsubscribeRPC.hmi_name, nil):Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) + end + + table.remove(sub_list) + mobileSession:ExpectResponse(cid, unsubscribeRPC.result) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI App 1", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { PTUfunc }) +runner.Step("Activate App", common.activateApp, { 1 }) +runner.Step("SubscribeWayPoints App 1", SubscribeWayPoints, { 1 }) +runner.Step("RAI App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App", common.activateApp, { 2 }) +runner.Step("SubscribeWayPoints App 2", SubscribeWayPoints, { 2 }) + +runner.Title("Test") +runner.Step("UnSubscribeWayPoints App 1", UnsubscribeWayPoints, { 1 }) +runner.Step("UnSubscribeWayPoints App 2", UnsubscribeWayPoints, { 2 }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/5_1/2874_SDL_sends_system_request_with_correlationid_-1_and_INAVLID_DATA.lua b/test_scripts/Defects/5_1/2874_SDL_sends_system_request_with_correlationid_-1_and_INAVLID_DATA.lua new file mode 100644 index 0000000000..abf7af6b17 --- /dev/null +++ b/test_scripts/Defects/5_1/2874_SDL_sends_system_request_with_correlationid_-1_and_INAVLID_DATA.lua @@ -0,0 +1,86 @@ +--------------------------------------------------------------------------------------------------- +-- Precondition: +-- 1) Application with is registered on SDL. +-- 2) Specific permissions are assigned for a cloud app with an icon_url +-- +-- Steps: +-- 1) Mobile sends a SystemRequest with an invalid RequestType("ION_URL") and correlation id of -1 +-- +-- Expected: +-- 1) SDL responds to mobile app with {ResultCode: "INVALID_ID", success: false} +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/CloudAppRPCs/commonCloudAppRPCs') +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") + + --[[ Test Configuration ]] + runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local cloud_app_id = "cloudAppID123" +local url = "https://fakeurl1234512345.com" +local icon_image_path = "files/icon.png" +config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 5 +config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 1 + +local rpc = { + name = "SystemRequest", + params = { + requestType = "ION_URL", + fileName = url + } +} + +local responseParams = { + success = false, + resultCode = "INVALID_ID" +} + +--[[ Local Functions ]] +local function PTUfunc(tbl) + params = { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = {"Base-4"}, + RequestType = {}, + RequestSubType = {}, + hybrid_app_preference = "CLOUD", + endpoint = "ws://192.168.1.1:3000/", + enabled = true, + cloud_transport_type = "WS", + icon_url = url, + nicknames = {"CloudApp"} + } + tbl.policy_table.app_policies[cloud_app_id] = params +end + +local function processRPCSuccess() + local mobileSession = common.getMobileSession(self, 1) + + mobileSession.correlationId = -2 + local cid = mobileSession:SendRPC(rpc.name, rpc.params, icon_image_path) + common.test_assert(commonFunctions:is_table_equal(cid, -1), "Incorrect correlation id") + + mobileSession:ExpectResponse(cid, responseParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Delete Storage", common.DeleteStorageFolder) + +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("RAI", common.registerApp) +runner.Step("PTU", common.policyTableUpdateWithIconUrl, { PTUfunc, nil, url }) + +runner.Step("Send App Icon SystemRequest_INVALID_ID", processRPCSuccess) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) +runner.Step("Delete Storage", common.DeleteStorageFolder) diff --git a/test_scripts/MobileProjection/Phase1/015_Restore_video_streaming_from_NONE.lua b/test_scripts/MobileProjection/Phase1/015_Restore_video_streaming_from_NONE.lua index f2cd9d197b..7deaa61238 100644 --- a/test_scripts/MobileProjection/Phase1/015_Restore_video_streaming_from_NONE.lua +++ b/test_scripts/MobileProjection/Phase1/015_Restore_video_streaming_from_NONE.lua @@ -45,7 +45,7 @@ local function EndServiceByUserExit() and data.frameInfo == constants.FRAME_INFO.END_SERVICE end common.getMobileSession():ExpectEvent(EndServiceEvent, "Expect EndServiceEvent") - :Do(function() + :DoOnce(function() common.getMobileSession():StopStreaming(FileForStreaming) common.getMobileSession():Send({ frameType = constants.FRAME_TYPE.CONTROL_FRAME, diff --git a/test_scripts/MobileProjection/Phase1/016_Restore_audio_streaming_from_NONE.lua b/test_scripts/MobileProjection/Phase1/016_Restore_audio_streaming_from_NONE.lua index 5c3aa8b354..4756798e9f 100644 --- a/test_scripts/MobileProjection/Phase1/016_Restore_audio_streaming_from_NONE.lua +++ b/test_scripts/MobileProjection/Phase1/016_Restore_audio_streaming_from_NONE.lua @@ -45,7 +45,7 @@ local function EndServiceByUserExit() and data.frameInfo == constants.FRAME_INFO.END_SERVICE end common.getMobileSession():ExpectEvent(EndServiceEvent, "Expect EndServiceEvent") - :Do(function() + :DoOnce(function() common.getMobileSession():StopStreaming(FileForStreaming) common.getMobileSession():Send({ frameType = constants.FRAME_TYPE.CONTROL_FRAME, diff --git a/test_scripts/Policies/App_Permissions/002_ATF_HP_OnPermissionsChange_With_Assigned_Policy_After_App_Registration.lua b/test_scripts/Policies/App_Permissions/002_ATF_HP_OnPermissionsChange_With_Assigned_Policy_After_App_Registration.lua index 6840635442..361f798ecc 100644 --- a/test_scripts/Policies/App_Permissions/002_ATF_HP_OnPermissionsChange_With_Assigned_Policy_After_App_Registration.lua +++ b/test_scripts/Policies/App_Permissions/002_ATF_HP_OnPermissionsChange_With_Assigned_Policy_After_App_Registration.lua @@ -190,22 +190,8 @@ function Test:Step2_Check_Disallowed_RPC() end function Test:Step3_Check_RPC_From_OnPermissionsChange_Allowance() - for i = 1, #RPC_BaseBeforeDataConsent do - if ( string.sub(RPC_BaseBeforeDataConsent[i],1,string.len("On")) ~= "On" ) then - local CorIdRAI = self.mobileSession:SendRPC(RPC_BaseBeforeDataConsent[i],{}) - EXPECT_RESPONSE(CorIdRAI, {}) - :ValidIf(function(_,data) - if data.payload.resultCode == "DISALLOWED" then - commonFunctions:printError("RPC: "..RPC_BaseBeforeDataConsent[i].." should be allowed by policy. Real: "..data.payload.resultCode) - return false - else - return true - end - end) - - break - end - end + local CorIdRAI = self.mobileSession:SendRPC("ListFiles", {}) + EXPECT_RESPONSE(CorIdRAI, { success = true, resultCode = "SUCCESS" }) end --[[ Postconditions ]] diff --git a/test_scripts/Policies/Policy_Table_Update/144_ATF_PTU_validation_failure.lua b/test_scripts/Policies/Policy_Table_Update/144_ATF_PTU_validation_failure.lua index 74272af529..374b3fed95 100644 --- a/test_scripts/Policies/Policy_Table_Update/144_ATF_PTU_validation_failure.lua +++ b/test_scripts/Policies/Policy_Table_Update/144_ATF_PTU_validation_failure.lua @@ -34,6 +34,7 @@ local testCasesForPolicyTable = require('user_modules/shared_testcases/testCases local testCasesForPolicyTableSnapshot = require('user_modules/shared_testcases/testCasesForPolicyTableSnapshot') local testCasesForPolicySDLErrorsStops = require('user_modules/shared_testcases/testCasesForPolicySDLErrorsStops') local utils = require ('user_modules/utils') +local commonTestCases = require ('user_modules/shared_testcases/commonTestCases') --[[ General Precondition before ATF start ]] commonSteps:DeleteLogsFileAndPolicyTable() @@ -109,6 +110,10 @@ function Test:TestStep_PTU_validation_failure() end end +function Test:Wait_3s() + commonTestCases:DelayedExp(3000) +end + function Test:TestStep_CheckSDLLogError() local is_test_fail = false diff --git a/test_scripts/Policies/Validation_of_PolicyTables/265_ATF_pt_snapshot_storage_on_file_system.lua b/test_scripts/Policies/Validation_of_PolicyTables/265_ATF_pt_snapshot_storage_on_file_system.lua index 08baa118d0..fe2b4fadf7 100644 --- a/test_scripts/Policies/Validation_of_PolicyTables/265_ATF_pt_snapshot_storage_on_file_system.lua +++ b/test_scripts/Policies/Validation_of_PolicyTables/265_ATF_pt_snapshot_storage_on_file_system.lua @@ -58,10 +58,7 @@ local TestData = { end end, delete = function(self) - if self.isExist then - os.execute("rm -r -f " .. self.path) - self.isExist = false - end + os.execute("rm -r -f " .. self.path) end, info = function(self) if self.isExist then @@ -139,6 +136,7 @@ end commonFunctions:newTestCasesGroup("Preconditions") function Test:StopSDL_precondition() + TestData:delete() TestData:init() StopSDL(self) end @@ -151,9 +149,15 @@ function Test:Precondition_StartSDL() StartSDL(config.pathToSDL, true) end -function Test:Precondition_InitHMIandMobileApp() +function Test:InitHMI() self:initHMI() +end + +function Test:InitHMI_onReady() self:initHMI_onReady() +end + +function Test:Precondition_InitHMIandMobileApp() self:connectMobile() self.mobileSession = mobile_session.MobileSession(self, self.mobileConnection) self.mobileSession:StartService(7) diff --git a/test_scripts/Policies/Validation_of_PolicyTables/282_ATF_PT_Exchanged_X_Days_After_Epoch_In_PTS.lua b/test_scripts/Policies/Validation_of_PolicyTables/282_ATF_PT_Exchanged_X_Days_After_Epoch_In_PTS.lua index edb27420f7..ffc3ef4f6a 100644 --- a/test_scripts/Policies/Validation_of_PolicyTables/282_ATF_PT_Exchanged_X_Days_After_Epoch_In_PTS.lua +++ b/test_scripts/Policies/Validation_of_PolicyTables/282_ATF_PT_Exchanged_X_Days_After_Epoch_In_PTS.lua @@ -49,7 +49,15 @@ local function getDaysAfterEpochFromPTS(pathToFile) end local function getSystemDaysAfterEpoch() - return math.floor(os.time()/86400) + local function getTimezoneOffset(ts) + local utcdate = os.date("!*t", ts) + local localdate = os.date("*t", ts) + localdate.isdst = false + return os.difftime(os.time(localdate), os.time(utcdate)) + end + local t = os.time() + local ofs = getTimezoneOffset(t) + return math.floor((t+ofs)/(60*60*24)) end --[[ Preconditions ]] diff --git a/test_scripts/Policies/user_consent_of_Policies/188_ATF_HP_Device_Data_Section_Validation.lua b/test_scripts/Policies/user_consent_of_Policies/188_ATF_HP_Device_Data_Section_Validation.lua index c70a1247ac..dee2df0b95 100644 --- a/test_scripts/Policies/user_consent_of_Policies/188_ATF_HP_Device_Data_Section_Validation.lua +++ b/test_scripts/Policies/user_consent_of_Policies/188_ATF_HP_Device_Data_Section_Validation.lua @@ -44,6 +44,7 @@ require('cardinalities') --[[ Required Shared libraries ]] local commonSteps = require ('user_modules/shared_testcases/commonSteps') local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') +local commonTestCases = require ('user_modules/shared_testcases/commonTestCases') local utils = require ('user_modules/utils') require('user_modules/AppTypes') @@ -172,9 +173,12 @@ function Test:Precondition_Activate_App_Consent_Device_Make_PTU_Consent_Group() EXPECT_HMIRESPONSE(RequestIdGetUserFriendlyMessage,{result = {code = 0, method = "SDL.GetUserFriendlyMessage"}}) :Do(function(_,_) local functionalGroupID = data1.result.allowedFunctions[1].id - self.hmiConnection:SendNotification("SDL.OnAppPermissionConsent", - { appID = self.applications["Test Application"], source = "GUI", consentedFunctions = {{name = "Location", allowed = true, id = functionalGroupID} }}) - GetCurrentTimeStampGroupConsent() + local function sendConsent() + self.hmiConnection:SendNotification("SDL.OnAppPermissionConsent", + { appID = self.applications["Test Application"], source = "GUI", consentedFunctions = {{name = "Location", allowed = true, id = functionalGroupID} }}) + GetCurrentTimeStampGroupConsent() + end + RUN_AFTER(sendConsent, 2000) end) end) end) @@ -186,7 +190,7 @@ function Test:Precondition_Activate_App_Consent_Device_Make_PTU_Consent_Group() end) end) end) - + commonTestCases:DelayedExp(4000) end --[[ Test ]] diff --git a/test_scripts/RC/AUDIO_LIGHT_HMI_SETTINGS/SetInteriorVehicleData/023_Success_flow_default_capabilities.lua b/test_scripts/RC/AUDIO_LIGHT_HMI_SETTINGS/SetInteriorVehicleData/023_Success_flow_default_capabilities.lua new file mode 100644 index 0000000000..87ab197bca --- /dev/null +++ b/test_scripts/RC/AUDIO_LIGHT_HMI_SETTINGS/SetInteriorVehicleData/023_Success_flow_default_capabilities.lua @@ -0,0 +1,46 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/3 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/develop/detailed_docs/RC/detailed_info_GetSystemCapability.md +-- Item: Main Flow: Exception 1 +-- +-- Requirement summary: +-- [SDL_RC] Set available control module settings SetInteriorVehicleData +-- +-- Description: +-- In case: +-- 1) Application is registered with REMOTE_CONTROL appHMIType +-- 2) HMI sends response to RC.GetCapabilities with invalid remoteControlCapability +-- 3) App sends valid SetInteriorVehicleData RPC with valid parameters +-- SDL must: +-- 1) Use default capabilities from hmi_capabilities.json +-- 2) Transfer this request to HMI +-- 3) Respond with received from HMI +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("test_scripts/RC/commonRC") +local hmi_values = require("user_modules/hmi_values") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +--modules array does not contain "RADIO" because "RADIO" module has read only parameters +local modules = { "CLIMATE", "AUDIO", "LIGHT", "HMI_SETTINGS" } +local hmiValues = hmi_values.getDefaultHMITable() +hmiValues.RC.GetCapabilities.params.remoteControlCapability = "fake_params" + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { hmiValues }) +runner.Step("RAI", common.registerAppWOPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, mod in pairs(modules) do + runner.Step("SetInteriorVehicleData " .. mod, common.rpcAllowed, { mod, 1, "SetInteriorVehicleData" }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_sets/SDL5_0/mobile_projection_2.txt b/test_sets/SDL5_0/mobile_projection_2.txt index 44b22cb7cb..fce382a1d1 100644 --- a/test_sets/SDL5_0/mobile_projection_2.txt +++ b/test_sets/SDL5_0/mobile_projection_2.txt @@ -20,4 +20,4 @@ ./test_scripts/MobileProjection/Phase2/020_different_types_apps_interactions.lua ./test_scripts/MobileProjection/Phase2/021_two_apps_and_deactivation.lua ./test_scripts/MobileProjection/Phase2/022_two_apps_proj_media_and_deactivation_streaming.lua -;./test_scripts/MobileProjection/Phase2/023_two_apps_navi_comm_and_deactivation_streaming.lua 2642 +./test_scripts/MobileProjection/Phase2/023_two_apps_navi_comm_and_deactivation_streaming.lua diff --git a/test_sets/SDL5_0/mobile_projection_2_smoke.txt b/test_sets/SDL5_0/mobile_projection_2_smoke.txt index ee0806fc08..9afa00eb91 100644 --- a/test_sets/SDL5_0/mobile_projection_2_smoke.txt +++ b/test_sets/SDL5_0/mobile_projection_2_smoke.txt @@ -19,4 +19,4 @@ ./test_scripts/MobileProjection/Phase2/smoke/020_different_types_apps_interactions.lua ./test_scripts/MobileProjection/Phase2/smoke/021_two_apps_and_deactivation.lua ./test_scripts/MobileProjection/Phase2/smoke/022_two_apps_proj_media_and_deactivation_streaming.lua -;./test_scripts/MobileProjection/Phase2/smoke/023_two_apps_navi_comm_and_deactivation_streaming.lua 2642 +./test_scripts/MobileProjection/Phase2/smoke/023_two_apps_navi_comm_and_deactivation_streaming.lua diff --git a/test_sets/app_services.txt b/test_sets/app_services.txt new file mode 100644 index 0000000000..16b8127afb --- /dev/null +++ b/test_sets/app_services.txt @@ -0,0 +1,76 @@ +./test_scripts/AppServices/AppServiceActivation/001_mobile_deactivate_success.lua +./test_scripts/AppServices/AppServiceActivation/002_hmi_deactivate_success.lua +./test_scripts/AppServices/AppServiceActivation/003_two_apps_activate_success.lua +./test_scripts/AppServices/AppServiceActivation/004_two_apps_default_disconnect_reconnect.lua +./test_scripts/AppServices/GetAppServiceData/001_M2M_success_flow.lua +./test_scripts/AppServices/GetAppServiceData/002_M2H_success_flow.lua +./test_scripts/AppServices/GetAppServiceData/003_H2M_success_flow.lua +./test_scripts/AppServices/GetAppServiceData/004_M2M_unknown_param_success.lua +./test_scripts/AppServices/GetAppServiceData/005_M2M_Nav_success_flow.lua +./test_scripts/AppServices/GetAppServiceData/006_M2M_Weather_success_flow.lua +./test_scripts/AppServices/GetAppServiceData/007_M2M_Future_service_type_success_flow.lua +./test_scripts/AppServices/GetAppServiceData/008_M2M_Timeout.lua +./test_scripts/AppServices/GetAppServiceData/009_M2H_Timeout.lua +./test_scripts/AppServices/GetAppServiceData/010_H2M_Timeout.lua +./test_scripts/AppServices/GetAppServiceData/011_M2M_GENERIC_ERROR.lua +./test_scripts/AppServices/GetAppServiceData/012_M2H_GENERIC_ERROR.lua +./test_scripts/AppServices/GetAppServiceData/013_H2M_GENERIC_ERROR.lua +./test_scripts/AppServices/GetAppServiceData/014_M2M_Unknown_ServiceType.lua +./test_scripts/AppServices/GetAppServiceData/015_M2H_Unknown_ServiceType.lua +./test_scripts/AppServices/GetAppServiceData/016_H2M_Unknown_ServiceType.lua +./test_scripts/AppServices/GetAppServiceRecords/001_GetAppServiceRecords_MOBILE.lua +./test_scripts/AppServices/GetAppServiceRecords/002_GetAppServiceRecords_HMI.lua +./test_scripts/AppServices/GetAppServiceRecords/003_GetAppServiceRecords_Multiple.lua +./test_scripts/AppServices/GetFile/001_GetFile_Success.lua +./test_scripts/AppServices/GetFile/002_GetFile_FileNotFound.lua +./test_scripts/AppServices/GetFile/003_GetFile_Mobile_ASP.lua +./test_scripts/AppServices/GetFile/004_GetFile_HMI_ASP.lua +./test_scripts/AppServices/GetFile/005_GetFile_Timeout_HMI_ASP.lua +./test_scripts/AppServices/OnAppServiceData/001_M2M_success_flow.lua +./test_scripts/AppServices/OnAppServiceData/002_M2H_success_flow.lua +./test_scripts/AppServices/OnAppServiceData/003_H2M_success_flow.lua +./test_scripts/AppServices/OnAppServiceData/004_OnAppServiceData_unknown_param_success.lua +./test_scripts/AppServices/OnAppServiceData/005_M2M_Nav_success_flow.lua +./test_scripts/AppServices/OnAppServiceData/006_M2M_Weather_success_flow.lua +./test_scripts/AppServices/OnAppServiceData/007_M2M_Future_service_type_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/001_M2M_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/002_M2H_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/003_H2M_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/004_M2M_unknown_parameter_success.lua +./test_scripts/AppServices/PerformAppServiceInteraction/005_Mobile_requestServiceActive_background_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/006_Mobile_requestServiceActive_foreground_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/007_HMI_requestServiceActive_success_flow.lua +./test_scripts/AppServices/PerformAppServiceInteraction/008_M2M_Timeout.lua +./test_scripts/AppServices/PerformAppServiceInteraction/009_M2H_Timeout.lua +./test_scripts/AppServices/PerformAppServiceInteraction/010_H2M_Timeout.lua +./test_scripts/AppServices/PerformAppServiceInteraction/011_M2M_GENERIC_ERROR.lua +./test_scripts/AppServices/PerformAppServiceInteraction/012_M2H_GENERIC_ERROR.lua +./test_scripts/AppServices/PerformAppServiceInteraction/013_H2M_GENERIC_ERROR.lua +./test_scripts/AppServices/PerformAppServiceInteraction/014_M2M_Unknown_ServiceId.lua +./test_scripts/AppServices/PerformAppServiceInteraction/015_M2H_Unknown_ServiceId.lua +./test_scripts/AppServices/PerformAppServiceInteraction/016_H2M_Unknown_ServiceId.lua +./test_scripts/AppServices/PublishAppService/001_Mobile_success_flow.lua +./test_scripts/AppServices/PublishAppService/002_HMI_success_flow.lua +./test_scripts/AppServices/PublishAppService/003_Nav_success_flow.lua +./test_scripts/AppServices/PublishAppService/004_Weather_success_flow.lua +./test_scripts/AppServices/PublishAppService/005_Future_service_type_success_flow.lua +./test_scripts/AppServices/PublishAppService/006_Mobile_disallowed_flow.lua +./test_scripts/AppServices/PublishAppService/007_Mobile_unknown_param_success.lua +./test_scripts/AppServices/RPCPassThrough/001_SendLocation_Handled_Request.lua +./test_scripts/AppServices/RPCPassThrough/002_SendLocation_Unsupported_Request.lua +./test_scripts/AppServices/RPCPassThrough/003_SendLocation_Request_Timeout.lua +./test_scripts/AppServices/RPCPassThrough/004_SendLocation_MultipleAS.lua +./test_scripts/AppServices/RPCPassThrough/005_SendLocation_Invalid_Permissions.lua +./test_scripts/AppServices/RPCPassThrough/006_ButtonPress_Handled_Request.lua +./test_scripts/AppServices/RPCPassThrough/007_ButtonPress_Invalid_Permissions.lua +./test_scripts/AppServices/RPCPassThrough/008_PTU_allow_unknown_rpc_passthrough.lua +./test_scripts/AppServices/RPCPassThrough/009_UnknownRPC_Consumer_UNSUPPORTED_REQUEST_policy_allow_flag_false.lua +./test_scripts/AppServices/RPCPassThrough/010_UnknownRpc_Handled_Request.lua +./test_scripts/AppServices/RPCPassThrough/011_UnknownRpc_Unsupported_Request.lua +./test_scripts/AppServices/RPCPassThrough/012_UnknownRpc_Request_Timeout.lua +./test_scripts/AppServices/RPCPassThrough/013_UnknownRpc_MultipleAS.lua +./test_scripts/AppServices/SystemCapabilities/001_GetSystemCapability_success.lua +./test_scripts/AppServices/SystemCapabilities/002_GetSystemCapabilitySubscribe_OnSystemCapability_on_unregister.lua +./test_scripts/AppServices/SystemCapabilities/003_OnSystemCapability_on_deactivate_service.lua +./test_scripts/AppServices/SystemCapabilities/004_GetSystemCapability_unsubscribe.lua +./test_scripts/AppServices/SystemCapabilities/005_OnSystemCapability_unknown_parameter_success.lua diff --git a/test_sets/cloudApp_RPCs.txt b/test_sets/cloudApp_RPCs.txt new file mode 100644 index 0000000000..3e54635dee --- /dev/null +++ b/test_sets/cloudApp_RPCs.txt @@ -0,0 +1,11 @@ +./test_scripts/CloudAppRPCs/001_CloupAppVehicleId_GetVehicleData.lua +./test_scripts/CloudAppRPCs/002_CloudAppVehicleId_SubscribeVehicleData.lua +./test_scripts/CloudAppRPCs/003_CloudAppVehicleId_UnsubscribeVehicleData.lua +./test_scripts/CloudAppRPCs/004_CloudAppVehicleId_OnVehicleData.lua +./test_scripts/CloudAppRPCs/005_SetCloudAppProperties_Success.lua +./test_scripts/CloudAppRPCs/006_SetCloudAppProperties_InvalidParams.lua +./test_scripts/CloudAppRPCs/007_SetCloudAppProperties_InitNewCloudApp.lua +./test_scripts/CloudAppRPCs/008_GetCloudAppProperties_Success.lua +./test_scripts/CloudAppRPCs/009_GetCloudAppProperties_DATA_NOT_AVAILABLE.lua +./test_scripts/CloudAppRPCs/010_get_icon_url.lua +./test_scripts/CloudAppRPCs/011_UpdateAppList_NewCloudApplication.lua diff --git a/test_sets/mobile_projection.txt b/test_sets/mobile_projection.txt index 824f42174e..a902784ff8 100644 --- a/test_sets/mobile_projection.txt +++ b/test_sets/mobile_projection.txt @@ -12,6 +12,6 @@ ./test_scripts/MobileProjection/Phase1/012_Retry_sequence_of_StartStream_during_video_service_start.lua ./test_scripts/MobileProjection/Phase1/013_Rejecting_StartAudioStream_during_audio_service_start.lua ./test_scripts/MobileProjection/Phase1/014_Rejecting_StartStream_during_video_service_start.lua -./test_scripts/MobileProjection/Phase1/015_Restore_video_streaming_from_NONE.lua -./test_scripts/MobileProjection/Phase1/016_Restore_audio_streaming_from_NONE.lua +;./test_scripts/MobileProjection/Phase1/015_Restore_video_streaming_from_NONE.lua 2721 +;./test_scripts/MobileProjection/Phase1/016_Restore_audio_streaming_from_NONE.lua 2721 ./test_scripts/MobileProjection/Phase1/017_HappyPath_flow_with_audio_video_streamings.lua diff --git a/test_sets/policies_happy_paths_HTTP.txt b/test_sets/policies_happy_paths_HTTP.txt index 4d7fec8300..4b824beab2 100644 --- a/test_sets/policies_happy_paths_HTTP.txt +++ b/test_sets/policies_happy_paths_HTTP.txt @@ -30,6 +30,7 @@ ./test_scripts/Policies/build_options/080_ATF_PTU_OnStatsusUpdate_Trigger_UPDATE_NEEDED_HTTP.lua ./test_scripts/Policies/build_options/081_ATF_PTU_OnStatsusUpdate_Trigger_UPDATING_HTTP.lua ./test_scripts/Policies/build_options/082_ATF_PTU_OnStatsusUpdate_Trigger_UP_TO_DATE_HTTP.lua +;./test_scripts/Policies/build_options/083_ATF_PTU_UTF8_Encoding_Check_HTTP.lua 1222 ./test_scripts/Policies/build_options/084_ATF_Default_Policy_For_The_App_After_PTU_HTTP.lua ./test_scripts/Policies/build_options/085_ATF_PTU_In_Progress_New_App_Registers_HTTP.lua ./test_scripts/Policies/build_options/086_ATF_PTU_Merging_wtih_LPT_HTTP.lua diff --git a/user_modules/dummy_connecttest.lua b/user_modules/dummy_connecttest.lua index 8dfeba68d8..d3a1e2acf6 100644 --- a/user_modules/dummy_connecttest.lua +++ b/user_modules/dummy_connecttest.lua @@ -332,7 +332,8 @@ function module:initHMI() "BasicCommunication.OnSDLClose", "SDL.OnSDLConsentNeeded", "BasicCommunication.OnResumeAudioSource", - "BasicCommunication.OnSystemTimeReady" + "BasicCommunication.OnSystemTimeReady", + "BasicCommunication.OnSystemCapabilityUpdated" }) registerComponent("UI", { @@ -348,6 +349,10 @@ function module:initHMI() "Navigation.OnAudioDataStreaming", "Navigation.OnVideoDataStreaming" }) + registerComponent("AppService", + { + "AppService.OnAppServiceData" + }) end) exp_waiter:AddExpectation(web_socket_connected_event)