<commit_before>---------------------------------------------------------------------------------------------
-- Requirement summary:
-- [Policies]: PreloadedPolicyTable: Validation rules for omited parameters - exists
--
-- Description:
-- Behavior of SDL during start SDL in case when PreloadedPT has omited parameters
-- 1. Used preconditions:
-- Delete files and policy table from previous ignition cycle if any
-- Do not start default SDL
-- 2. Performed steps:
-- Create PreloadedPolicyTable file with couple omited parameters
-- Start SDL
--
-- Expected result:
-- PolicyManager shut SDL down
---------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local commonFunctions = require ('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions')
local testCasesForPolicyTable = require('user_modules/shared_testcases/testCasesForPolicyTable')
-- local json = require("modules/json")
-- local SDL = require('modules/SDL')
local testCasesForPolicySDLErrorsStops = require('user_modules/shared_testcases/testCasesForPolicySDLErrorsStops')

--[[ Local Variables ]]
local PRELOADED_PT_FILE_NAME = "sdl_preloaded_pt.json"

--[[ General Precondition before ATF start ]]
config.defaultProtocolVersion = 2

--[[ General configuration parameters ]]
Test = require('connecttest')
require("user_modules/AppTypes")

--[[ Preconditions ]]
function Test:Precondition_stop_sdl()
  StopSDL(self)
end

function Test.Precondition()
  local testParameters = {vehicle_model = "Fiesta", vehicle_make = "Ford", vehicle_year = 2015}
  commonSteps:DeletePolicyTable()
  commonPreconditions:BackupFile(PRELOADED_PT_FILE_NAME)
  testCasesForPolicySDLErrorsStops.updatePreloadedPT("data.policy_table.module_config", testParameters)
end

--[[ Test ]]
function Test:TestStep_start_sdl()
  --TODO(istoimenova): Should be checked when ATF problem is fixed with SDL crash
  --EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose")
  testCasesForPolicySDLErrorsStops:CheckSDLShutdown(self)
end

function Test.TestStep_CheckSDLLogError()
  testCasesForPolicySDLErrorsStops.ReadSpecificMessage("Policy table is not initialized.")
end

--[[ Postconditions ]]
commonFunctions:newTestCasesGroup("Postconditions")
testCasesForPolicyTable:Restore_preloaded_pt()
function Test.Postcondition_Stop()
  StopSDL()
end<commit_msg>Added result code.<commit_after>---------------------------------------------------------------------------------------------
-- Requirement summary:
-- [Policies]: PreloadedPolicyTable: Validation rules for omited parameters - exists
--
-- Description:
-- Behavior of SDL during start SDL in case when PreloadedPT has omited parameters
-- 1. Used preconditions:
-- Delete files and policy table from previous ignition cycle if any
-- Do not start default SDL
-- 2. Performed steps:
-- Create PreloadedPolicyTable file with couple omited parameters
-- Start SDL
--
-- Expected result:
-- PolicyManager shut SDL down
---------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local commonFunctions = require ('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions')
local testCasesForPolicyTable = require('user_modules/shared_testcases/testCasesForPolicyTable')
-- local json = require("modules/json")
-- local SDL = require('modules/SDL')
local testCasesForPolicySDLErrorsStops = require('user_modules/shared_testcases/testCasesForPolicySDLErrorsStops')

--[[ Local Variables ]]
local PRELOADED_PT_FILE_NAME = "sdl_preloaded_pt.json"

--[[ General Precondition before ATF start ]]
config.defaultProtocolVersion = 2

--[[ General configuration parameters ]]
Test = require('connecttest')
require("user_modules/AppTypes")

--[[ Preconditions ]]
function Test:Precondition_stop_sdl()
  StopSDL(self)
end

function Test.Precondition()
  local testParameters = {vehicle_model = "Fiesta", vehicle_make = "Ford", vehicle_year = 2015}
  commonSteps:DeletePolicyTable()
  commonSteps:DeleteLogsFiles()
  commonPreconditions:BackupFile(PRELOADED_PT_FILE_NAME)
  testCasesForPolicySDLErrorsStops.updatePreloadedPT("data.policy_table.module_config", testParameters)
end

--[[ Test ]]
function Test:TestStep_start_sdl()
  --TODO(istoimenova): Should be checked when ATF problem is fixed with SDL crash
  EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose")
  local result = testCasesForPolicySDLErrorsStops:CheckSDLShutdown(self)
  if (result == false) then
    self:FailTestCase("Error: SDL doesn't stop.")
  end
end

function Test:TestStep_CheckSDLLogError()
  local result = testCasesForPolicySDLErrorsStops.ReadSpecificMessage("Policy table is not initialized.")
  if (result == false) then
    self:FailTestCase("Error: message 'Policy table is not initialized.' is not observed in smartDeviceLink.log.")
  end
end

--[[ Postconditions ]]
commonFunctions:newTestCasesGroup("Postconditions")
testCasesForPolicyTable:Restore_preloaded_pt()
function Test.Postcondition_Stop()
  StopSDL()
end
{'fraction_non_alphanumeric': 0.16077472734110568, 'fraction_numerical': 0.0026325686348251222, 'mean_word_length': 4.075381679389313, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1380052', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1431, 'n_words': 348}