19 #include <experimental/filesystem> 21 #include <gtest/gtest.h> 22 #include <gmock/gmock.h> 23 #include <aws/logs/model/InputLogEvent.h> 24 #include <aws/core/utils/memory/stl/AWSString.h> 25 #include <aws/core/utils/logging/ConsoleLogSystem.h> 26 #include <aws/core/utils/logging/AWSLogging.h> 30 #include <file_management/utils/log_file_manager.h> 44 std::experimental::filesystem::path storage_path(options.storage_directory);
45 std::experimental::filesystem::remove_all(storage_path);
56 std::shared_ptr<FileManagerStrategy> file_manager_strategy = std::make_shared<FileManagerStrategy>(options);
57 LogFileManager file_manager(file_manager_strategy);
58 LogEventCollection log_data;
59 Aws::CloudWatchLogs::Model::InputLogEvent input_event;
60 input_event.SetTimestamp(0);
61 input_event.SetMessage(
"Hello my name is foo");
62 log_data.push_back(input_event);
63 file_manager.write(log_data);
65 file_manager_strategy->read(line);
66 EXPECT_EQ(line,
"{\"timestamp\":0,\"message\":\"Hello my name is foo\"}");
69 int main(
int argc,
char** argv)
71 Aws::Utils::Logging::InitializeAWSLogging(
72 Aws::MakeShared<Aws::Utils::Logging::ConsoleLogSystem>(
73 "RunUnitTests", Aws::Utils::Logging::LogLevel::Trace));
74 ::testing::InitGoogleMock(&argc, argv);
75 int exitCode = RUN_ALL_TESTS();
76 Aws::Utils::Logging::ShutdownAWSLogging();
int main(int argc, char **argv)
TEST_F(FileManagerTest, file_manager_write)