Correction of test-ccnx-wrapper. Small logging changes in executor
diff --git a/executor/executor.cc b/executor/executor.cc
index b1d3593..d9f3893 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -22,7 +22,7 @@
#include "executor.h"
#include "logging.h"
-INIT_LOGGER ("Executor");
+INIT_MEMBER_LOGGER(Executor,"Executor")
using namespace std;
using namespace boost;
diff --git a/executor/executor.h b/executor/executor.h
index c8e6cb0..6ed3d62 100644
--- a/executor/executor.h
+++ b/executor/executor.h
@@ -30,6 +30,8 @@
#include <boost/thread/thread.hpp>
#include <deque>
+#include "logging.h"
+
/* A very simple executor to execute submitted tasks immediately or
* in the future (depending on whether there is idle thread)
* A fixed number of threads are created for executing tasks;
@@ -83,6 +85,8 @@
volatile bool m_needStop;
int m_poolSize;
+
+ MEMBER_LOGGER
};
typedef boost::shared_ptr<Executor> ExecutorPtr;
diff --git a/src/logging.h b/src/logging.h
index 849d2e8..78d0eea 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -28,6 +28,12 @@
#include <log4cxx/logger.h>
+#define MEMBER_LOGGER \
+ static log4cxx::LoggerPtr staticModuleLogger;
+
+#define INIT_MEMBER_LOGGER(className,name) \
+ log4cxx::LoggerPtr className::staticModuleLogger = log4cxx::Logger::getLogger (name);
+
#define INIT_LOGGER(name) \
static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger (name);
@@ -66,6 +72,9 @@
#define _LOG_ERROR_COND(cond,x)
#define _LOG_DEBUG_COND(cond,x)
+#define MEMBER_LOGGER
+#define INIT_MEMBER_LOGGER(className,name)
+
#ifdef _DEBUG
#include <boost/thread/thread.hpp>
diff --git "a/test/.\043test-ccnx-wrapper.cc" "b/test/.\043test-ccnx-wrapper.cc"
new file mode 120000
index 0000000..23e4010
--- /dev/null
+++ "b/test/.\043test-ccnx-wrapper.cc"
@@ -0,0 +1 @@
+cawka@cawka-mac.55285
\ No newline at end of file
diff --git a/test/test-ccnx-wrapper.cc b/test/test-ccnx-wrapper.cc
index 7f2efb7..42516ea 100644
--- a/test/test-ccnx-wrapper.cc
+++ b/test/test-ccnx-wrapper.cc
@@ -1,3 +1,24 @@
+/* -*- 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: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
#include "ccnx-wrapper.h"
#include "ccnx-closure.h"
#include "ccnx-name.h"
@@ -7,7 +28,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/test/unit_test.hpp>
-
+#include <boost/make_shared.hpp>
using namespace Ccnx;
using namespace std;
@@ -15,8 +36,8 @@
BOOST_AUTO_TEST_SUITE(CcnxWrapperTests)
-CcnxWrapperPtr c1(new CcnxWrapper());
-CcnxWrapperPtr c2(new CcnxWrapper());
+CcnxWrapperPtr c1;
+CcnxWrapperPtr c2;
int g_timeout_counter = 0;
int g_dataCallback_counter = 0;
@@ -48,6 +69,9 @@
BOOST_AUTO_TEST_CASE (CcnxWrapperTest)
{
+ c1 = make_shared<CcnxWrapper> ();
+ c2 = make_shared<CcnxWrapper> ();
+
Name prefix1("/c1");
Name prefix2("/c2");