1 #include "serialization_tests.hpp" 2 #include "elog_entry.hpp" 3 #include "elog_serialize.hpp" 4 5 namespace phosphor 6 { 7 namespace logging 8 { 9 namespace test 10 { 11 12 TEST_F(TestSerialization, testProperties) 13 { 14 auto id = 99; 15 phosphor::logging::AssociationList assocations{}; 16 std::vector<std::string> testData{"additional", "data"}; 17 uint64_t timestamp{100}; 18 std::string message{"test error"}; 19 auto input = std::make_unique<Entry>( 20 bus, 21 std::string(OBJ_ENTRY) + '/' + std::to_string(id), 22 id, 23 timestamp, 24 Entry::Level::Informational, 25 std::move(message), 26 std::move(testData), 27 std::move(assocations), 28 manager); 29 auto path = serialize(*input, TestSerialization::dir); 30 31 auto idStr = path.filename().c_str(); 32 id = std::stol(idStr); 33 auto output = std::make_unique<Entry>( 34 bus, 35 std::string(OBJ_ENTRY) + '/' + idStr, 36 id, 37 manager); 38 deserialize(path, *output); 39 40 EXPECT_EQ(input->id(), output->id()); 41 EXPECT_EQ(input->severity(), output->severity()); 42 EXPECT_EQ(input->timestamp(), output->timestamp()); 43 EXPECT_EQ(input->message(), output->message()); 44 EXPECT_EQ(input->additionalData(), output->additionalData()); 45 EXPECT_EQ(input->resolved(), output->resolved()); 46 EXPECT_EQ(input->associations(), output->associations()); 47 } 48 49 } // namespace test 50 } // namespace logging 51 } // namespace phosphor 52 53 54