Lines Matching refs:store_
64 store_.reset(new JsonStore(test_file_)); in SetUp()
81 unique_ptr<JsonStore> store_; member in shill::JsonStoreTest
100 EXPECT_TRUE(store_->SetString("group_a", "knob_1", our_value)); in TEST_F()
101 EXPECT_TRUE(store_->GetString("group_a", "knob_1", &value_from_store)); in TEST_F()
110 EXPECT_TRUE(store_->SetBool("group_a", "knob_1", our_value)); in TEST_F()
111 EXPECT_TRUE(store_->GetBool("group_a", "knob_1", &value_from_store)); in TEST_F()
121 EXPECT_TRUE(store_->SetInt("group_a", "knob_1", our_value)); in TEST_F()
122 EXPECT_TRUE(store_->GetInt("group_a", "knob_1", &value_from_store)); in TEST_F()
134 EXPECT_TRUE(store_->SetUint64("group_a", "knob_1", our_value)); in TEST_F()
135 EXPECT_TRUE(store_->GetUint64("group_a", "knob_1", &value_from_store)); in TEST_F()
151 EXPECT_TRUE(store_->SetStringList("group_a", "knob_1", our_value)); in TEST_F()
152 EXPECT_TRUE(store_->GetStringList("group_a", "knob_1", &value_from_store)); in TEST_F()
163 EXPECT_TRUE(store_->SetCryptedString("group_a", "knob_1", our_value)); in TEST_F()
165 store_->GetCryptedString("group_a", "knob_1", &value_from_store)); in TEST_F()
176 EXPECT_TRUE(store_->SetCryptedString("group_a", "knob_1", our_value)); in TEST_F()
177 EXPECT_TRUE(store_->GetString("group_a", "knob_1", &raw_value_from_store)); in TEST_F()
183 store_->SetString("group_a", "knob_1", "value_1"); in TEST_F()
184 store_->SetString("group_b", "knob_1", "value_2"); in TEST_F()
187 EXPECT_TRUE(store_->GetString("group_a", "knob_1", &value_from_store)); in TEST_F()
189 EXPECT_TRUE(store_->GetString("group_b", "knob_1", &value_from_store)); in TEST_F()
198 EXPECT_FALSE(store_->GetString("group_a", "string_knob", nullptr)); in TEST_F()
199 EXPECT_FALSE(store_->GetBool("group_a", "bool_knob", nullptr)); in TEST_F()
200 EXPECT_FALSE(store_->GetInt("group_a", "int_knob", nullptr)); in TEST_F()
201 EXPECT_FALSE(store_->GetUint64("group_a", "uint64_knob", nullptr)); in TEST_F()
202 EXPECT_FALSE(store_->GetStringList("group_a", "string_list_knob", nullptr)); in TEST_F()
204 store_->GetCryptedString("group_a", "crypted_string_knob", nullptr)); in TEST_F()
206 ASSERT_TRUE(store_->SetString("group_a", "random_knob", "random value")); in TEST_F()
208 EXPECT_FALSE(store_->GetString("group_a", "string_knob", nullptr)); in TEST_F()
209 EXPECT_FALSE(store_->GetBool("group_a", "bool_knob", nullptr)); in TEST_F()
210 EXPECT_FALSE(store_->GetInt("group_a", "int_knob", nullptr)); in TEST_F()
211 EXPECT_FALSE(store_->GetUint64("group_a", "uint64_knob", nullptr)); in TEST_F()
212 EXPECT_FALSE(store_->GetStringList("group_a", "string_list_knob", nullptr)); in TEST_F()
214 store_->GetCryptedString("group_a", "crypted_string_knob", nullptr)); in TEST_F()
216 ASSERT_TRUE(store_->SetString("group_a", "string_knob", "stuff goes here")); in TEST_F()
217 ASSERT_TRUE(store_->SetBool("group_a", "bool_knob", true)); in TEST_F()
218 ASSERT_TRUE(store_->SetInt("group_a", "int_knob", -1)); in TEST_F()
219 ASSERT_TRUE(store_->SetUint64("group_a", "uint64_knob", 1)); in TEST_F()
220 ASSERT_TRUE(store_->SetStringList( in TEST_F()
223 store_->SetCryptedString("group_a", "crypted_string_knob", "s3kr!t")); in TEST_F()
225 EXPECT_TRUE(store_->GetString("group_a", "string_knob", nullptr)); in TEST_F()
226 EXPECT_TRUE(store_->GetBool("group_a", "bool_knob", nullptr)); in TEST_F()
227 EXPECT_TRUE(store_->GetInt("group_a", "int_knob", nullptr)); in TEST_F()
228 EXPECT_TRUE(store_->GetUint64("group_a", "uint64_knob", nullptr)); in TEST_F()
229 EXPECT_TRUE(store_->GetStringList("group_a", "string_list_knob", nullptr)); in TEST_F()
231 store_->GetCryptedString("group_a", "crypted_string_knob", nullptr)); in TEST_F()
239 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", &value_from_store)); in TEST_F()
245 EXPECT_TRUE(store_->SetBool("group_a", "knob_1", true)); in TEST_F()
247 EXPECT_FALSE(store_->GetBool("group_b", "knob_1", &value_from_store)); in TEST_F()
253 EXPECT_TRUE(store_->SetBool("group_a", "knob_1", true)); in TEST_F()
255 EXPECT_FALSE(store_->GetBool("group_a", "knob_2", &value_from_store)); in TEST_F()
261 EXPECT_TRUE(store_->SetBool("group_a", "knob_1", true)); in TEST_F()
263 EXPECT_FALSE(store_->GetBool("group_b", "knob_1", &value_from_store)); in TEST_F()
269 EXPECT_TRUE(store_->SetString("group_a", "knob_1", "value_1")); in TEST_F()
271 EXPECT_FALSE(store_->GetString("group_a", "value_1", &value_from_store)); in TEST_F()
280 EXPECT_TRUE(store_->SetString("group_a", "knob_1", "stuff goes here")); in TEST_F()
281 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
282 EXPECT_FALSE(store_->GetInt("group_a", "knob_1", nullptr)); in TEST_F()
283 EXPECT_FALSE(store_->GetUint64("group_a", "knob_1", nullptr)); in TEST_F()
284 EXPECT_FALSE(store_->GetStringList("group_a", "knob_1", nullptr)); in TEST_F()
294 EXPECT_TRUE(store_->SetBool("group_a", "knob_1", true)); in TEST_F()
295 EXPECT_FALSE(store_->GetString("group_a", "knob_1", nullptr)); in TEST_F()
296 EXPECT_FALSE(store_->GetInt("group_a", "knob_1", nullptr)); in TEST_F()
297 EXPECT_FALSE(store_->GetUint64("group_a", "knob_1", nullptr)); in TEST_F()
298 EXPECT_FALSE(store_->GetStringList("group_a", "knob_1", nullptr)); in TEST_F()
299 EXPECT_FALSE(store_->GetCryptedString("group_a", "knob_1", nullptr)); in TEST_F()
307 EXPECT_TRUE(store_->SetInt("group_a", "knob_1", -1)); in TEST_F()
308 EXPECT_FALSE(store_->GetString("group_a", "knob_1", nullptr)); in TEST_F()
309 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
310 EXPECT_FALSE(store_->GetUint64("group_a", "knob_1", nullptr)); in TEST_F()
311 EXPECT_FALSE(store_->GetStringList("group_a", "knob_1", nullptr)); in TEST_F()
312 EXPECT_FALSE(store_->GetCryptedString("group_a", "knob_1", nullptr)); in TEST_F()
320 EXPECT_TRUE(store_->SetUint64("group_a", "knob_1", 1)); in TEST_F()
321 EXPECT_FALSE(store_->GetString("group_a", "knob_1", nullptr)); in TEST_F()
322 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
323 EXPECT_FALSE(store_->GetInt("group_a", "knob_1", nullptr)); in TEST_F()
324 EXPECT_FALSE(store_->GetStringList("group_a", "knob_1", nullptr)); in TEST_F()
325 EXPECT_FALSE(store_->GetCryptedString("group_a", "knob_1", nullptr)); in TEST_F()
333 EXPECT_TRUE(store_->SetStringList( in TEST_F()
335 EXPECT_FALSE(store_->GetString("group_a", "knob_1", nullptr)); in TEST_F()
336 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
337 EXPECT_FALSE(store_->GetInt("group_a", "knob_1", nullptr)); in TEST_F()
338 EXPECT_FALSE(store_->GetUint64("group_a", "knob_1", nullptr)); in TEST_F()
339 EXPECT_FALSE(store_->GetCryptedString("group_a", "knob_1", nullptr)); in TEST_F()
347 EXPECT_TRUE(store_->SetCryptedString("group_a", "knob_1", "s3kr!t")); in TEST_F()
350 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
351 EXPECT_FALSE(store_->GetInt("group_a", "knob_1", nullptr)); in TEST_F()
352 EXPECT_FALSE(store_->GetUint64("group_a", "knob_1", nullptr)); in TEST_F()
353 EXPECT_FALSE(store_->GetStringList("group_a", "knob_1", nullptr)); in TEST_F()
359 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
360 EXPECT_TRUE(store_->DeleteKey("group_a", "knob_1")); in TEST_F()
362 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
366 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
367 store_->SetBool("group_a", "knob_2", bool()); in TEST_F()
368 EXPECT_TRUE(store_->DeleteKey("group_a", "knob_1")); in TEST_F()
369 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
370 EXPECT_TRUE(store_->GetBool("group_a", "knob_2", nullptr)); in TEST_F()
374 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
375 EXPECT_TRUE(store_->DeleteKey("group_a", "knob_2")); in TEST_F()
376 EXPECT_TRUE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
381 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
383 EXPECT_FALSE(store_->DeleteKey("group_b", "knob_1")); in TEST_F()
384 EXPECT_TRUE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
389 EXPECT_EQ(set<string>(), store_->GetGroups()); in TEST_F()
390 EXPECT_EQ(set<string>(), store_->GetGroupsWithKey("knob_1")); in TEST_F()
391 EXPECT_EQ(set<string>(), store_->GetGroupsWithProperties(KeyValueStore())); in TEST_F()
395 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
396 store_->SetBool("group_b", "knob_1", bool()); in TEST_F()
397 EXPECT_EQ(set<string>({"group_a", "group_b"}), store_->GetGroups()); in TEST_F()
401 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
402 store_->SetBool("group_b", "knob_1", bool()); in TEST_F()
404 store_->GetGroupsWithKey("knob_1")); in TEST_F()
408 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
409 store_->SetBool("group_b", "knob_2", bool()); in TEST_F()
410 EXPECT_EQ(set<string>({"group_a"}), store_->GetGroupsWithKey("knob_1")); in TEST_F()
414 store_->SetBool("group_a", "knob_1", true); in TEST_F()
415 store_->SetBool("group_b", "knob_1", true); in TEST_F()
420 store_->GetGroupsWithProperties(required_properties)); in TEST_F()
424 store_->SetBool("group_a", "knob_1", true); in TEST_F()
425 store_->SetBool("group_b", "knob_1", false); in TEST_F()
430 store_->GetGroupsWithProperties(required_properties)); in TEST_F()
434 store_->SetBool("group_a", "knob_1", true); in TEST_F()
435 store_->SetBool("group_a", "knob_2", true); in TEST_F()
436 store_->SetBool("group_b", "knob_1", true); in TEST_F()
437 store_->SetBool("group_b", "knob_2", false); in TEST_F()
443 store_->GetGroupsWithProperties(required_properties)); in TEST_F()
465 store_->SetString("group_a", "knob_1", "good-string"); in TEST_F()
466 store_->SetBool("group_a", "knob_2", true); in TEST_F()
467 store_->SetInt("group_a", "knob_3", 1); in TEST_F()
474 store_->GetGroupsWithProperties(correct_properties)); in TEST_F()
490 EXPECT_EQ(set<string>(), store_->GetGroupsWithProperties(bad_properties)) in TEST_F()
496 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
497 EXPECT_TRUE(store_->ContainsGroup("group_a")); in TEST_F()
501 EXPECT_FALSE(store_->ContainsGroup("group_a")); in TEST_F()
506 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
507 store_->SetBool("group_a", "knob_2", bool()); in TEST_F()
508 EXPECT_TRUE(store_->DeleteGroup("group_a")); in TEST_F()
510 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
511 EXPECT_FALSE(store_->GetBool("group_a", "knob_2", nullptr)); in TEST_F()
515 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
516 store_->SetBool("group_b", "knob_1", bool()); in TEST_F()
517 EXPECT_TRUE(store_->DeleteGroup("group_a")); in TEST_F()
518 EXPECT_FALSE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
519 EXPECT_TRUE(store_->GetBool("group_b", "knob_1", nullptr)); in TEST_F()
523 store_->SetBool("group_a", "knob_1", bool()); in TEST_F()
524 EXPECT_TRUE(store_->DeleteGroup("group_b")); in TEST_F()
525 EXPECT_TRUE(store_->GetBool("group_a", "knob_1", nullptr)); in TEST_F()
532 EXPECT_TRUE(store_->Open()); in TEST_F()
540 EXPECT_FALSE(store_->Open()); in TEST_F()
549 EXPECT_FALSE(store_->Open()); in TEST_F()
557 store_->Open(); in TEST_F()
565 EXPECT_FALSE(store_->Open()); in TEST_F()
571 EXPECT_TRUE(store_->Open()); in TEST_F()
579 EXPECT_FALSE(store_->Open()); in TEST_F()
588 EXPECT_TRUE(store_->Open()); in TEST_F()
599 EXPECT_FALSE(store_->Open()); in TEST_F()
612 EXPECT_TRUE(store_->Open()); in TEST_F()
621 EXPECT_TRUE(store_->Open()); in TEST_F()
630 EXPECT_TRUE(store_->Open()); in TEST_F()
639 EXPECT_TRUE(store_->Open()); in TEST_F()
650 EXPECT_TRUE(store_->Open()); in TEST_F()
661 EXPECT_TRUE(store_->Open()); in TEST_F()
672 EXPECT_TRUE(store_->Open()); in TEST_F()
682 EXPECT_TRUE(store_->Open()); in TEST_F()
691 EXPECT_TRUE(store_->Open()); in TEST_F()
701 EXPECT_TRUE(store_->Open()); in TEST_F()
712 EXPECT_TRUE(store_->Open()); in TEST_F()
725 EXPECT_TRUE(store_->Open()); in TEST_F()
741 EXPECT_FALSE(store_->Open()); in TEST_F()
752 EXPECT_FALSE(store_->Open()); in TEST_F()
763 EXPECT_FALSE(store_->Open()); in TEST_F()
774 EXPECT_FALSE(store_->Open()); in TEST_F()
785 EXPECT_FALSE(store_->Open()); in TEST_F()
797 EXPECT_FALSE(store_->Open()); in TEST_F()
810 EXPECT_FALSE(store_->Open()); in TEST_F()
823 EXPECT_FALSE(store_->Open()); in TEST_F()
836 EXPECT_FALSE(store_->Open()); in TEST_F()
850 EXPECT_FALSE(store_->Open()); in TEST_F()
864 EXPECT_FALSE(store_->Open()); in TEST_F()
878 EXPECT_FALSE(store_->Open()); in TEST_F()
890 EXPECT_FALSE(store_->Open()); in TEST_F()
895 store_->SetString("group_a", "knob_1", "watch me disappear"); in TEST_F()
896 ASSERT_TRUE(store_->GetString("group_a", "knob_1", nullptr)); in TEST_F()
903 ASSERT_TRUE(store_->Open()); in TEST_F()
904 EXPECT_FALSE(store_->GetString("group_a", "knob_1", nullptr)); in TEST_F()
905 EXPECT_TRUE(store_->GetString("group_a", "knob_2", nullptr)); in TEST_F()
909 store_->SetString("group_a", "knob_1", "watch me disappear"); in TEST_F()
910 ASSERT_FALSE(store_->GetGroups().empty()); in TEST_F()
916 ASSERT_TRUE(store_->Open()); in TEST_F()
917 EXPECT_TRUE(store_->GetGroups().empty()); in TEST_F()
922 ASSERT_FALSE(store_->IsNonEmpty()); in TEST_F()
923 ASSERT_TRUE(store_->Close()); in TEST_F()
939 ASSERT_FALSE(store_->IsNonEmpty()); in TEST_F()
940 ASSERT_TRUE(store_->Flush()); in TEST_F()
958 EXPECT_FALSE(store_->Flush()); in TEST_F()
970 store_->SetHeader("rosetta stone"); in TEST_F()
971 ASSERT_EQ("rosetta stone", store_->file_description_); in TEST_F()
972 store_->Flush(); in TEST_F()
977 store_->file_description_, persisted_data.file_description_); in TEST_F()
981 store_->SetString("group_a", "string_knob", "our string"); in TEST_F()
982 store_->SetBool("group_a", "bool_knob", true); in TEST_F()
983 store_->SetInt("group_a", "int_knob", 1); in TEST_F()
984 store_->SetUint64( in TEST_F()
986 store_->SetStringList( in TEST_F()
988 store_->SetCryptedString("group_a", "cryptedstring_knob", "s3kr!t"); in TEST_F()
989 store_->Flush(); in TEST_F()
994 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
998 store_->SetString("group_a", "string_knob", kNonUtf8String); in TEST_F()
999 store_->Flush(); in TEST_F()
1004 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
1008 store_->SetStringList( in TEST_F()
1010 store_->Flush(); in TEST_F()
1015 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
1019 store_->SetString("group_a", "string_knob", kStringWithEmbeddedNulls); in TEST_F()
1020 store_->Flush(); in TEST_F()
1025 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
1029 store_->SetStringList( in TEST_F()
1031 store_->Flush(); in TEST_F()
1036 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
1040 store_->SetString("group_a", "knob_1", "first string"); in TEST_F()
1041 store_->SetString("group_b", "knob_2", "second string"); in TEST_F()
1042 store_->Flush(); in TEST_F()
1047 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
1051 store_->SetString("group_a", "knob_1", "first string"); in TEST_F()
1052 store_->SetString("group_a", "knob_2", "second string"); in TEST_F()
1053 store_->SetString("group_b", "knob_1", "frist post!"); in TEST_F()
1054 store_->SetStringList("group_b", "knob_2", vector<string>{"2nd try"}); in TEST_F()
1055 store_->Flush(); in TEST_F()
1060 store_->group_name_to_settings_, persisted_data.group_name_to_settings_); in TEST_F()
1064 store_->SetString("group_a", "knob_1", "first string"); in TEST_F()
1065 store_->Flush(); in TEST_F()
1070 store_->DeleteKey("group_a", "knob_1"); in TEST_F()
1071 store_->Flush(); in TEST_F()
1083 store_->SetString("group_a", "knob_1", "first string"); in TEST_F()
1084 store_->Flush(); in TEST_F()
1089 store_->DeleteGroup("group_a"); in TEST_F()
1090 store_->Flush(); in TEST_F()
1103 EXPECT_FALSE(store_->MarkAsCorrupted()); in TEST_F()
1107 store_->Flush(); in TEST_F()
1108 ASSERT_TRUE(store_->IsNonEmpty()); in TEST_F()
1111 EXPECT_TRUE(store_->MarkAsCorrupted()); in TEST_F()
1112 EXPECT_FALSE(store_->IsNonEmpty()); in TEST_F()