Commit e0c20837 authored by Maria Fava's avatar Maria Fava
Browse files

added dim in test

parent d52cd0e9
......@@ -10,6 +10,7 @@
#include "ADDH.h"
#include "ADDHCmd.h"
#include "Config.h"
#include "WriterFile.h"
#include "local-config.h"
#include "test_helpers.hpp"
......@@ -21,9 +22,12 @@ class TestADDHCmdFile : public CppUnit::TestFixture
protected:
CPPUNIT_TEST_SUITE(TestADDHCmdFile);
CPPUNIT_TEST(validatePath);
CPPUNIT_TEST(receiveCommandWithRelativePath);
CPPUNIT_TEST(receiveCommandWithAbsolutePath);
CPPUNIT_TEST_SUITE_END();
bfs::path abs_tmp, abs_tmp_in, rel_tmp, rel_tmp_in;
std::unique_ptr<DimTestHelper> m_dim;
public:
void setUp()
......@@ -36,6 +40,8 @@ public:
bfs::create_directories(abs_tmp_in);
rel_tmp_in = "./test_ADDHCmd_in";
bfs::create_directories(rel_tmp_in);
m_dim.reset(new DimTestHelper());
}
void tearDown()
......@@ -44,13 +50,44 @@ public:
bfs::remove_all(rel_tmp);
bfs::remove_all(rel_tmp_in);
bfs::remove_all(rel_tmp_in);
m_dim.reset();
}
void receiveCommand(bfs::path filename)
{
std::shared_ptr<ADDH> addh(new ADDH);
WriterFile writer(addh);
COMMAND_ELEMENT command = {std::string("write"), 6789, 12345,
filename.string()};
DimInfoWaiter info("ADDH/Events");
EQ(true, info.waitUpdate());
writer.addCommand(command);
EQ(true, info.waitUpdate(2));
EQ(true, bfs::exists(filename));
}
void receiveCommandWithRelativePath()
{
bfs::path filename = rel_tmp / "path";
receiveCommand(filename);
}
void receiveCommandWithAbsolutePath()
{
bfs::path filename = abs_tmp / "path";
receiveCommand(filename);
}
void validatePath()
{
ADDHCmd *addhCmd_ = new ADDHCmd();
// create a filepath to be used as filepathPrefix
bfs::path abs_path_tmp = abs_tmp / "path";
bfs::create_directories(abs_path_tmp);
bfs::path rel_path_tmp = rel_tmp / "path";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment