diff options
Diffstat (limited to 'src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc')
-rw-r--r-- | src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc index a9c7667ba6..ce51682f3c 100644 --- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc @@ -65,32 +65,24 @@ class SQLPTExtRepresentationTest : public ::testing::Test { SQLPTExtRepresentationTest() : reps_(NULL) {} protected: - SQLPTExtRepresentation* reps_; + std::shared_ptr<SQLPTExtRepresentation> reps_; policy_handler_test::MockPolicySettings policy_settings_; - static const string kDatabaseName; PermissionConsent perm_consent; FunctionalGroupPermission group1_perm; FunctionalGroupPermission group2_perm; - utils::dbms::SQLQuery* query_wrapper_; - static const bool in_memory_; - const std::string kAppStorageFolder = "storage_SQLPTExtRepresentationTest"; + std::shared_ptr<utils::dbms::SQLQuery> query_wrapper_; void SetUp() OVERRIDE { - file_system::DeleteFile(kDatabaseName); - reps_ = new SQLPTExtRepresentation(in_memory_); + reps_ = std::make_shared<SQLPTExtRepresentation>(true); ASSERT_TRUE(reps_ != NULL); - ON_CALL(policy_settings_, app_storage_folder()) - .WillByDefault(ReturnRef(kAppStorageFolder)); ASSERT_EQ(SUCCESS, reps_->Init(&policy_settings_)); - query_wrapper_ = new utils::dbms::SQLQuery(reps_->db()); + query_wrapper_ = std::make_shared<utils::dbms::SQLQuery>(reps_->db()); ASSERT_TRUE(query_wrapper_ != NULL); } void TearDown() OVERRIDE { - delete query_wrapper_; EXPECT_TRUE(reps_->Drop()); EXPECT_TRUE(reps_->Close()); - delete reps_; } void FillGroupPermission( @@ -261,9 +253,6 @@ SQLPTExtRepresentationTest::GetDataInternal( return table.policy_table.functional_groupings; } -const string SQLPTExtRepresentationTest::kDatabaseName = ":memory:"; -const bool SQLPTExtRepresentationTest::in_memory_ = true; - ::testing::AssertionResult IsValid(const policy_table::Table& table) { if (table.is_valid()) { return ::testing::AssertionSuccess(); @@ -1541,8 +1530,8 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) { const HmiLevel test_level_1 = HL_FULL; const HmiLevel test_level_2 = HL_LIMITED; - const policy_table::Parameter test_parameter_1 = P_GPS; - const policy_table::Parameter test_parameter_2 = P_SPEED; + const std::string test_parameter_1 = "P_GPS"; + const std::string test_parameter_2 = "P_SPEED"; Rpcs rpcs; @@ -1578,7 +1567,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) { *another_rpcs.user_consent_prompt = another_user_consent_prompt; const HmiLevel test_level_3 = HL_BACKGROUND; - const policy_table::Parameter test_parameter_3 = P_BELTSTATUS; + const std::string test_parameter_3 = "P_BELTSTATUS"; RpcParameters another_parameters; another_parameters.hmi_levels.push_back(test_level_3); @@ -1615,10 +1604,10 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) { EXPECT_TRUE( (IsKeyExist<HmiLevels>(loaded_parameters.hmi_levels, test_level_2))); - EXPECT_TRUE(( - IsKeyExist<Parameters>(*loaded_parameters.parameters, test_parameter_1))); - EXPECT_TRUE(( - IsKeyExist<Parameters>(*loaded_parameters.parameters, test_parameter_2))); + EXPECT_TRUE((IsKeyExist<Parameters, std::string>( + *loaded_parameters.parameters, test_parameter_1))); + EXPECT_TRUE((IsKeyExist<Parameters, std::string>( + *loaded_parameters.parameters, test_parameter_2))); Rpcs another_loaded_rpcs = GetKeyData<FunctionalGroupings, Rpcs>( loaded_groupings, another_group_name); @@ -1637,8 +1626,8 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) { EXPECT_TRUE((IsKeyExist<HmiLevels>(another_loaded_parameters.hmi_levels, test_level_3))); - EXPECT_TRUE((IsKeyExist<Parameters>(*another_loaded_parameters.parameters, - test_parameter_3))); + EXPECT_TRUE((IsKeyExist<Parameters, std::string>( + *another_loaded_parameters.parameters, test_parameter_3))); } TEST_F(SQLPTExtRepresentationTest, JsonContentsExternalConsent_ExpectParsed) { |