[asterisk-scf-commits] asterisk-scf/integration/logger.git branch "filename" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Mar 14 17:09:33 CDT 2011


branch "filename" has been updated
       via  89913e2ec673202c8ad86138f77cbd51ec4304b8 (commit)
      from  df11e7299041cb14c0e7e6ae16bacab26684ee4e (commit)

Summary of changes:
 server/test/CMakeLists.txt                         |    5 ++
 server/test/ConfigurationComponent.cpp             |   54 ++++++++++++++++++++
 .../test/ConfigurationComponent.h                  |   35 ++++---------
 3 files changed, 70 insertions(+), 24 deletions(-)
 create mode 100644 server/test/ConfigurationComponent.cpp
 copy include/AsteriskSCF/Logger/LogOut.h => server/test/ConfigurationComponent.h (50%)


- Log -----------------------------------------------------------------
commit 89913e2ec673202c8ad86138f77cbd51ec4304b8
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Mar 14 17:08:15 2011 -0500

    Start tweaking server tests to include configuration test.
    
    This push contains some simple code to be able to add or remove
    output file configuration. The real meat will be the code that uses
    this class to push code to a running logging server. Hi.

diff --git a/server/test/CMakeLists.txt b/server/test/CMakeLists.txt
index 94b4643..d98c113 100644
--- a/server/test/CMakeLists.txt
+++ b/server/test/CMakeLists.txt
@@ -6,6 +6,8 @@
 # All rights reserved.
 #
 
+asterisk_scf_slice_include_directories(${API_SLICE_DIR})
+
 asterisk_scf_component_init(logging-service-test CXX)
 
 include_directories(../src)
@@ -13,7 +15,10 @@ include_directories(../../include)
 
 asterisk_scf_component_add_file(logging-service-test LoggingServer-test.cpp)
 asterisk_scf_component_add_file(logging-service-test server-test.cpp)
+asterisk_scf_component_add_file(logging-service-test ConfigurationComponent.cpp)
+asterisk_scf_component_add_file(logging-service-test ConfigurationComponent.h)
 
+asterisk_scf_component_add_slice(logging-service-test ../local-slice/LoggingConfigurationIf.ice)
 asterisk_scf_component_add_boost_libraries(logging-service-test unit_test_framework)
 
 include_directories(${API_INCLUDE_DIR})
diff --git a/server/test/ConfigurationComponent.cpp b/server/test/ConfigurationComponent.cpp
new file mode 100644
index 0000000..e745a7b
--- /dev/null
+++ b/server/test/ConfigurationComponent.cpp
@@ -0,0 +1,54 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+/**
+ * This is a component that pushes test data to the logging server.
+ */
+
+#include "ConfigurationComponent.h"
+#include "LoggingConfigurationIf.h"
+
+namespace
+{
+    const std::string FileItemName("file");
+};
+
+using namespace AsteriskSCF::System::Configuration::V1;
+using namespace AsteriskSCF::System::Logger::V1;
+
+LoggingConfigurationPusher::LoggingConfigurationPusher(const ConfigurationServicePrx &config)
+    : mConfigPrx(config) { }
+
+void LoggingConfigurationPusher::setLogOutFile(const std::string &fileName, int serialNumber)
+{
+    ConfigurationGroupSeq groups;
+    LoggerGeneralGroupPtr generalGroup(new LoggerGeneralGroup);
+    FileItemPtr fileItem(new FileItem);
+    fileItem->fileName = fileName;
+    fileItem->serialNumber = serialNumber;
+    generalGroup->configurationItems.insert(make_pair(FileItemName, fileItem));
+    mConfigPrx->setConfiguration(groups);
+}
+
+void LoggingConfigurationPusher::removeLogOutFile(const std::string &fileName)
+{
+    ConfigurationGroupSeq groups;
+    LoggerGeneralGroupPtr generalGroup(new LoggerGeneralGroup);
+    FileItemPtr fileItem(new FileItem);
+    fileItem->fileName = fileName;
+    generalGroup->configurationItems.insert(make_pair(FileItemName, fileItem));
+    mConfigPrx->removeConfigurationItems(groups);
+}
diff --git a/server/test/ConfigurationComponent.h b/server/test/ConfigurationComponent.h
new file mode 100644
index 0000000..ab9a6ab
--- /dev/null
+++ b/server/test/ConfigurationComponent.h
@@ -0,0 +1,31 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+/**
+ * This is a component that pushes test data to the logging server.
+ */
+
+#include <AsteriskSCF/System/Component/ConfigurationIf.h>
+
+class LoggingConfigurationPusher
+{
+public:
+    LoggingConfigurationPusher(const AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx &config);
+    void setLogOutFile(const std::string &fileName, int serialNumber);
+    void removeLogOutFile(const std::string &fileName);
+private:
+    AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx mConfigPrx;
+};

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/logger.git



More information about the asterisk-scf-commits mailing list