Initial stuff for sqllite version of object-db. Changing to boost::filesystem
diff --git a/test/database-test.cc b/test/database-test.cc
index a4fe0d6..633c4cf 100644
--- a/test/database-test.cc
+++ b/test/database-test.cc
@@ -26,19 +26,22 @@
#include "action-log.h"
#include <iostream>
#include <ccnx-name.h>
+#include <boost/filesystem.hpp>
using namespace std;
using namespace boost;
using namespace Ccnx;
+namespace fs = boost::filesystem;
BOOST_AUTO_TEST_SUITE(DatabaseTest)
BOOST_AUTO_TEST_CASE (BasicDatabaseTest)
{
- char dir_tmpl [] = "/tmp/tmp-chornoshare-XXXXXXXXXXX";
- string tmp_dir = mkdtemp (dir_tmpl);
- SyncLog db (tmp_dir, "/alex");
+ fs::path tmpdir = fs::unique_path (fs::temp_directory_path () / "%%%%-%%%%-%%%%-%%%%");
+ fs::create_directories (tmpdir);
+
+ SyncLog db (tmpdir, "/alex");
HashPtr hash = db.RememberStateInStateLog ();
// should be empty
@@ -77,6 +80,7 @@
// db.FindStateDifferences ("86b51f1f98662583b295b61385ae4450ff8fac955981f1ca4381144ab1d7a4e0",
// "d001d4680fd9adcb48e34a795e3cc3d5d36f209fbab34fd57f70f362c2085310");
+ remove_all (tmpdir);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/test-object-manager.cc b/test/test-object-manager.cc
new file mode 100644
index 0000000..a27fd1b
--- /dev/null
+++ b/test/test-object-manager.cc
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ */
+
+#include "object-manager.h"
+
+#include <boost/filesystem.hpp>
+#include <boost/test/unit_test.hpp>
+#include <unistd.h>
+#include <boost/make_shared.hpp>
+#include <iostream>
+
+using namespace Ccnx;
+using namespace std;
+using namespace boost;
+using namespace boost::filesystem;
+
+BOOST_AUTO_TEST_SUITE(ObjectManagerTests)
+
+BOOST_AUTO_TEST_CASE (ObjectManagerTest)
+{
+ path tmpdir = unique_path (temp_directory_path () / "%%%%-%%%%-%%%%-%%%%");
+ create_directories (tmpdir);
+
+ Name deviceName ("/device");
+
+ CcnxWrapperPtr ccnx = make_shared<CcnxWrapper> ();
+ ObjectManager manager (ccnx, deviceName, tmpdir);
+
+
+ remove_all (tmpdir);
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()