Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Byrne committed Jul 23, 2019
1 parent 0a51e2c commit 0197618
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---------------------------------------------------------------------------------------------------
-- Precondition:
-- 1) Application with <appID> is registered on SDL.
-- 2) Specific permissions are assigned for <appID> with PublishAppService
-- 3) App sends a PublishAppService RPC request
-- 4) Application with <appID2> is registered on SDL.
--
-- Steps:
-- 1) App2 sends a UnpublishAppService RPC to core
--
-- Expected:
-- 1) SDL responds to mobile app2 with "resultCode: INVALID_ID, success: false"
---------------------------------------------------------------------------------------------------

--[[ 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 = "UnpublishAppService",
params = {
serviceID = "temp"
}
}

local expectedResponse = {
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.getAppServiceProducerConfig(2);
end

--[[ Local Functions ]]
local function processRPCFailure(self)
rpc.params.serviceID = common.getAppServiceID(1)
local mobileSession = common.getMobileSession(2)
local cid = mobileSession:SendRPC(rpc.name, rpc.params)

mobileSession:ExpectNotification("OnSystemCapabilityUpdated",
common.appServiceCapabilityUpdateParams("REMOVED", manifest)):Times(0)
mobileSession:ExpectResponse(cid, expectedResponse)

EXPECT_HMINOTIFICATION("BasicCommunication.OnSystemCapabilityUpdated",
common.appServiceCapabilityUpdateParams("REMOVED", 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.Step("Publish App Service", common.publishMobileAppService, { manifest })
runner.Step("RAI w/o PTU", common.registerAppWOPTU, { 2 })

runner.Title("Test")
runner.Step("RPC " .. rpc.name .. "Update_resultCode_INVALID_ID", processRPCFailure)

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

3 changes: 3 additions & 0 deletions test_sets/app_services.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
./test_scripts/AppServices/PublishAppService/008_Mobile_update_service_success.lua
./test_scripts/AppServices/PublishAppService/009_Mobile_duplicate_name_rejected.lua
./test_scripts/AppServices/PublishAppService/010_HMI_update_service_success.lua
./test_scripts/AppServices/UnpublishAppService/001_Mobile_success_flow.lua
./test_scripts/AppServices/UnpublishAppService/002_HMI_success_flow.lua
./test_scripts/AppServices/UnpublishAppService/003_Mobile_failure_did_not_publish_requested_service.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
Expand Down

0 comments on commit 0197618

Please sign in to comment.