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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Feb 16 18:30:08 CST 2012


branch "retry_deux" has been updated
       via  de46b50bdac5daa35d2075c49ec2012329173073 (commit)
      from  0ba350316c6f85bf96306a24ccdafd35385ab702 (commit)

Summary of changes:
 client/test/IceConfigurator-test.cpp |   18 +++++++++++++++---
 server/src/Component.cpp             |   22 +++++++++++++++++-----
 server/src/LoggingServer.cpp         |    2 +-
 3 files changed, 33 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit de46b50bdac5daa35d2075c49ec2012329173073
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu Feb 16 18:29:17 2012 -0600

    Updates.

diff --git a/client/test/IceConfigurator-test.cpp b/client/test/IceConfigurator-test.cpp
index 8f8a679..fd66fb8 100644
--- a/client/test/IceConfigurator-test.cpp
+++ b/client/test/IceConfigurator-test.cpp
@@ -32,6 +32,18 @@ void addConfig(Configuration& cfg, const std::string& name, Level logLevel)
 
     cfg.sourceSettings.push_back(sourceConfig);
 }
+
+OperationContextPtr createContext()
+{
+    AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
+    newContext->id = IceUtil::generateUUID();
+
+    // To make it easy to identify the "source" operation id, we set the transaction id to the 
+    // same value as the original OperationContext id. 
+    newContext->transactionId = newContext->id;
+    return newContext;
+}
+
 }
 
 BOOST_AUTO_TEST_SUITE(IceConfiguratorTest)
@@ -49,7 +61,7 @@ BOOST_AUTO_TEST_CASE(test_simple)
     addConfig(cfg, "AsteriskSCF.Core", Debug);
     addConfig(cfg, "", Error);
 
-    uut.configured(new OperationContext(IceUtil::generateUUID()), cfg);
+    uut.configured(createContext(), cfg);
 
     BOOST_CHECK_EQUAL(Error, factory.getLogger("").getEffectiveLevel());
     BOOST_CHECK_EQUAL(Info, factory.getLogger("AsteriskSCF").getEffectiveLevel());
@@ -69,11 +81,11 @@ BOOST_AUTO_TEST_CASE(test_reset)
     addConfig(cfg, "AsteriskSCF", Info);
     addConfig(cfg, "AsteriskSCF.Core", Debug);
     addConfig(cfg, "AsteriskSCF.Media", Off);
-    uut.configured(new OperationContext(IceUtil::generateUUID()), cfg);
+    uut.configured(createContext(), cfg);
 
     cfg.sourceSettings.clear();
     addConfig(cfg, "", Critical);
-    uut.configured(new OperationContext(IceUtil::generateUUID()), cfg);
+    uut.configured(createContext(), cfg);
 
     BOOST_CHECK_EQUAL(Critical, factory.getLogger("").getEffectiveLevel());
     BOOST_CHECK_EQUAL(Critical, factory.getLogger("AsteriskSCF").getEffectiveLevel());
diff --git a/server/src/Component.cpp b/server/src/Component.cpp
index 82d6407..2633ae3 100644
--- a/server/src/Component.cpp
+++ b/server/src/Component.cpp
@@ -61,6 +61,17 @@ private:
 };
 }
 
+OperationContextPtr createContext()
+{
+    AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
+    newContext->id = IceUtil::generateUUID();
+
+    // To make it easy to identify the "source" operation id, we set the transaction id to the 
+    // same value as the original OperationContext id. 
+    newContext->transactionId = newContext->id;
+    return newContext;
+}
+
 void LoggingService::registerWithServiceLocator(const Ice::CommunicatorPtr& communicator)
 {
     try
@@ -79,26 +90,27 @@ void LoggingService::registerWithServiceLocator(const Ice::CommunicatorPtr& comm
                     communicator->stringToProxy(locatorManagementProxyString));
 
             {
-            mServiceManagement = management->addService(mServerPrx,
+            mServiceManagement = management->addService(createContext(), mServerPrx,
                 mName + "." + LoggingServerGuid);
 
             ServiceLocatorParamsPtr params(new ServiceLocatorParams);
             params->category = LoggingServerCategory;
             params->service = serviceName;
             params->id = mName;
-            mServiceManagement->addLocatorParams(new OperationContext(IceUtil::generateUUID()), params, "");
+            mServiceManagement->addLocatorParams(createContext(), params, "");
             }
 
             // Do the same for the configuration interface.
             {
-            mConfigManagement = management->addService(mConfigurationServicePrx,
+            mConfigManagement = management->addService(createContext(), 
+                mConfigurationServicePrx,
                 IceUtil::generateUUID());
 
             ServiceLocatorParamsPtr configParams(new ServiceLocatorParams);
             configParams->category = AsteriskSCF::Configuration::LoggingService::V1::ConfigurationDiscoveryCategory;
             configParams->service = serviceName;
             configParams->id = mName;
-            mConfigManagement->addLocatorParams(new OperationContext(IceUtil::generateUUID()), configParams, "");
+            mConfigManagement->addLocatorParams(createContext(), configParams, "");
             }
         }
         else
@@ -210,7 +222,7 @@ void LoggingService::stop()
 {
     if (mServiceManagement)
     {
-        mServiceManagement->unregister();
+        mServiceManagement->unregister(createContext());
     }
 }
 
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index 4d284db..554c887 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -77,7 +77,7 @@ void LoggingServerI::setLevel(const std::string& name, Level level)
 
     if (mConfigurationListener)
     {
-        mConfigurationListener->configured(new OperationContext(IceUtil::generateUUID()), getConfiguration());
+        mConfigurationListener->configured(new OperationContext(IceUtil::generateUUID(), IceUtil::generateUUID()), getConfiguration());
     }
 }
 

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


-- 
asterisk-scf/integration/logger.git



More information about the asterisk-scf-commits mailing list