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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Mar 16 09:32:03 CDT 2012


branch "retry_deux" has been updated
       via  bf24a105985c98d18103138fab480ecf4e263f88 (commit)
       via  ab11dc1d69e959ef7966bb359433060723b77c27 (commit)
       via  22e66682ea772f2871bf519a45b4585d45a66d06 (commit)
       via  260f2778ce9edc2f2bb046daf45720b9996028e4 (commit)
       via  7c99739049b99848d3c4e2215f343412f8a3c759 (commit)
       via  49de44e17305e5ef7f8fba20ace61f10b01bf400 (commit)
      from  ede106cd7214bf79c06ee2d0567e7a10c4ca9b0e (commit)

Summary of changes:
 config/test_component.conf                         |    2 +-
 .../ServiceLocatorStateReplicationIf.ice           |    3 +
 src/ServiceLocator.cpp                             |    4 +-
 test/TestServiceLocator.cpp                        |   47 +++++++-------------
 4 files changed, 21 insertions(+), 35 deletions(-)


- Log -----------------------------------------------------------------
commit bf24a105985c98d18103138fab480ecf4e263f88
Merge: ede106c ab11dc1
Author: David M. Lee <dlee at digium.com>
Date:   Fri Mar 16 09:07:22 2012 -0500

    Merge branch 'master' into retry_deux

diff --cc slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice
index e502784,3f509a9..8fabc6c
mode 100755,100644..100755
--- a/slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice

commit ab11dc1d69e959ef7966bb359433060723b77c27
Author: David M. Lee <dlee at digium.com>
Date:   Fri Feb 24 13:56:36 2012 -0600

    Change prefix name for CollocatedIceStorm.
    
    This was specified by a property, but that extra level of indirection
    makes it really confusing. Plus, the name specified was always the
    service's appName anyways. So just go with that.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 1851327..014805d 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -170,9 +170,7 @@ void ServiceLocatorImpl::locateAll_async(const AMD_ServiceLocator_locateAllPtr&
 void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr& communicator,
     const Ice::StringSeq&)
 {
-    mIceStorm = new AsteriskSCF::CollocatedIceStorm::CollocatedIceStorm(communicator->getProperties()->getPropertyWithDefault(
-                                                                            appName + ".IceStorm.InstanceName", "ServiceDiscovery"),
-                                                                        communicator->getProperties());
+    mIceStorm = new AsteriskSCF::CollocatedIceStorm::CollocatedIceStorm(appName, communicator->getProperties());
 
     string backplaneAdapterName = appName + ".BackplaneAdapter";
     mLocalAdapter = communicator->createObjectAdapterWithEndpoints(backplaneAdapterName,

commit 22e66682ea772f2871bf519a45b4585d45a66d06
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Feb 8 18:26:06 2012 -0600

    Cleanup unit test exception handling. Let the test framework handle exceptions.

diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index ebdae5d..6c698d0 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -171,46 +171,32 @@ struct GlobalIceFixture
         ::boost::debug::detect_memory_leaks(false);
         ::boost::unit_test::unit_test_log.set_stream( std::cout );
 
-        int status = 0;
-        try
-        {
-            testbed.communicatorIncoming = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
-
-            testbed.adapter = testbed.communicatorIncoming->createObjectAdapterWithEndpoints("CompareServiceAdapter", "default -h 127.0.0.1");
+        testbed.communicatorIncoming = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
 
-            ServiceLocatorParamsComparePtr CompareService = new TestCompareServiceImpl();
+        testbed.adapter = testbed.communicatorIncoming->createObjectAdapterWithEndpoints("CompareServiceAdapter", "default -h 127.0.0.1");
 
-            testbed.compare = ServiceLocatorParamsComparePrx::uncheckedCast(testbed.adapter->addWithUUID(CompareService));
+        ServiceLocatorParamsComparePtr CompareService = new TestCompareServiceImpl();
 
-            testbed.adapter->activate();
+        testbed.compare = ServiceLocatorParamsComparePrx::uncheckedCast(testbed.adapter->addWithUUID(CompareService));
 
-            testbed.communicatorOutgoing = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
+        testbed.adapter->activate();
 
-            // TODO: This should use a configuration file most likely instead of hardcoding
+        testbed.communicatorOutgoing = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
 
-            testbed.management = ServiceLocatorManagementPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorServiceManagement:tcp -h 127.0.0.1 -p 4412"));
-
-            if (!testbed.management)
-            {
-                throw "Invalid service discovery management proxy";
-            }
+        // TODO: This should use a configuration file most likely instead of hardcoding
 
-            testbed.discovery = ServiceLocatorPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorService:tcp -h 127.0.0.1 -p 4411"));
+        testbed.management = ServiceLocatorManagementPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorServiceManagement:tcp -h 127.0.0.1 -p 4412"));
 
-            if (!testbed.discovery)
-            {
-                throw "Invalid service discovery proxy";
-            }
-        }
-        catch (const Ice::Exception& ex)
+        if (!testbed.management)
         {
-            cerr << ex << endl;
-            status = 1;
+            throw "Invalid service discovery management proxy";
         }
-        catch (const char* msg)
+
+        testbed.discovery = ServiceLocatorPrx::checkedCast(testbed.communicatorOutgoing->stringToProxy("LocatorService:tcp -h 127.0.0.1 -p 4411"));
+
+        if (!testbed.discovery)
         {
-            cerr << msg << endl;
-            status = 1;
+            throw "Invalid service discovery proxy";
         }
         
     } // end Fixture() constructor
@@ -219,7 +205,6 @@ struct GlobalIceFixture
     {
         BOOST_TEST_MESSAGE("Tearing down service discovery test fixture");
 
-
         if (testbed.communicatorIncoming)
         {
             testbed.communicatorIncoming->shutdown();

commit 260f2778ce9edc2f2bb046daf45720b9996028e4
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Feb 6 17:52:02 2012 -0600

    Reverted replicator. ServiceLocator doesn't benefit from the base replicator class.

diff --git a/config/test_component.conf b/config/test_component.conf
index 24a5805..7ea0784 100644
--- a/config/test_component.conf
+++ b/config/test_component.conf
@@ -20,7 +20,7 @@ IceBox.LoadOrder=ServiceDiscoveryStateReplicator,ServiceDiscovery,ServiceDiscove
 #
 # ServiceDiscovery configuration
 #
-IceBox.Service.ServiceDiscovery=service_locator:create
+IceBox.Service.ServiceDiscovery=ServiceLocator:create
 
 # Test endpoints for the service locator local adapter
 ServiceDiscovery.BackplaneAdapter.Endpoints=tcp -h 127.0.0.1 -p 4410
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 728cf52..85d3f77 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,7 +18,7 @@ astscf_component_install(ServiceLocator)
 
 astscf_component_init(ServiceLocatorStateReplicator)
 astscf_component_add_slices(ServiceLocatorStateReplicator PROJECT AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice)
-astscf_component_add_files(ServiceLocatorStateReplicator ComponentStateReplicator.cpp)
+astscf_component_add_files(ServiceLocatorStateReplicator ServiceLocatorStateReplicatorApp.cpp)
 astscf_component_add_files(ServiceLocatorStateReplicator ServiceLocatorStateReplicator.h)
 astscf_component_add_ice_libraries(ServiceLocatorStateReplicator IceStorm)
 astscf_component_add_boost_libraries(ServiceLocatorStateReplicator thread date_time)
diff --git a/src/ComponentStateReplicator.cpp b/src/ComponentStateReplicator.cpp
deleted file mode 100644
index 75c72ca..0000000
--- a/src/ComponentStateReplicator.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, 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.
- */
-
-#include <Ice/Ice.h>
-
-#include <AsteriskSCF/Component/ComponentStateReplicator.h>
-#include <AsteriskSCF/Logger.h>
-#include "ServiceLocatorStateReplicator.h"
-
-using namespace std;
-using namespace AsteriskSCF::Core;
-using namespace AsteriskSCF::Discovery;
-using namespace AsteriskSCF::Core::Discovery::V1;
-using namespace AsteriskSCF::System::Component::V1;
-using namespace AsteriskSCF::System::Logging;
-using namespace AsteriskSCF::Replication::ServiceLocator::V1;
-
-namespace
-{
-Logger lg = getLoggerFactory().getLogger("AsteriskSCF.ServiceLocatorStateReplicator");
-}
-
-class ComponentStateReplicator : public AsteriskSCF::Component::ComponentStateReplicator
-{
-public:
-    ComponentStateReplicator() :
-      AsteriskSCF::Component::ComponentStateReplicator(lg, 
-          AsteriskSCF::Replication::ServiceLocator::V1::StateReplicatorComponentCategory, 
-          false)  // if true, supports configuration
-    {
-    }
-
-    ~ComponentStateReplicator() {};
-
-    ///////////////////////////////////////////////////
-    // Required overrides
-
-    void createPrimaryServices();
-    void preparePrimaryServicesForDiscovery();
-
-private:
-    ServiceLocatorStateReplicatorIPtr mStateReplicator;
-    ServiceLocatorStateReplicatorPrx mStateReplicatorPrx;
-    LocatorRegistrationWrapperPtr mStateReplicatorRegistration;
-};
-
-static const string ServiceDiscoveryId("ServiceLocatorStateReplicatorService");
-
-/**
- * Register this component's primary public interfaces with the Service Locator.
- * This enables other Asterisk SCF components to locate our interfaces.
- */
-void ComponentStateReplicator::preparePrimaryServicesForDiscovery()
-{
-    try
-    {
-        // Wrap our authentication extensions point for the Service Locator.
-        mStateReplicatorRegistration = wrapServiceForRegistration(mStateReplicatorPrx,
-                                                                  AsteriskSCF::Replication::ServiceLocator::V1::StateReplicatorDiscoveryCategory);
-        managePrimaryService(mStateReplicatorRegistration);
-    }
-    catch(const std::exception& e)
-    {
-        lg(Error) << "Unable to publish component interfaces in " << getName() << BOOST_CURRENT_FUNCTION <<
-            ". Exception: " << e.what();
-        throw; // rethrow
-    }
-}
-
-void ComponentStateReplicator::createPrimaryServices()
-{
-    // Create the state replicator servant
-    mStateReplicator = new ServiceLocatorStateReplicatorI();
-
-    mStateReplicatorPrx = ServiceLocatorStateReplicatorPrx::uncheckedCast(
-       getServiceAdapter()->add(mStateReplicator, getCommunicator()->stringToIdentity(ServiceDiscoveryId)));
-}
-
-extern "C"
-{
-ASTSCF_DLL_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
-{
-    return new ComponentStateReplicator;
-}
-}
-
diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index c39619d..ebdae5d 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -212,7 +212,7 @@ struct GlobalIceFixture
             cerr << msg << endl;
             status = 1;
         }
-        BOOST_CHECK_EQUAL(0, status);
+        
     } // end Fixture() constructor
 
     ~GlobalIceFixture()

commit 7c99739049b99848d3c4e2215f343412f8a3c759
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Feb 6 11:40:42 2012 -0600

    Correction for file name case change.

diff --git a/src/ComponentStateReplicator.cpp b/src/ComponentStateReplicator.cpp
index 92dcd09..75c72ca 100644
--- a/src/ComponentStateReplicator.cpp
+++ b/src/ComponentStateReplicator.cpp
@@ -17,7 +17,7 @@
 #include <Ice/Ice.h>
 
 #include <AsteriskSCF/Component/ComponentStateReplicator.h>
-#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Logger.h>
 #include "ServiceLocatorStateReplicator.h"
 
 using namespace std;

commit 49de44e17305e5ef7f8fba20ace61f10b01bf400
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Feb 3 18:37:03 2012 -0600

    State replicator uses base class ComponentStateReplicator.

diff --git a/slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice b/slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice
index 3ec0dd1..3f509a9 100644
--- a/slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice
@@ -32,6 +32,9 @@ module ServiceLocator
 ["suppress"]
 module V1
 {
+   const string StateReplicatorComponentCategory = "ServiceLocatorStateReplicatorComponent";
+   const string StateReplicatorDiscoveryCategory = "ServiceLocatorStateReplicator";
+
    class ServiceLocatorStateItem
    {
       string key;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6a91640..728cf52 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,10 +18,10 @@ astscf_component_install(ServiceLocator)
 
 astscf_component_init(ServiceLocatorStateReplicator)
 astscf_component_add_slices(ServiceLocatorStateReplicator PROJECT AsteriskSCF/Replication/ServiceLocator/ServiceLocatorStateReplicationIf.ice)
-astscf_component_add_files(ServiceLocatorStateReplicator ServiceLocatorStateReplicatorApp.cpp)
+astscf_component_add_files(ServiceLocatorStateReplicator ComponentStateReplicator.cpp)
 astscf_component_add_files(ServiceLocatorStateReplicator ServiceLocatorStateReplicator.h)
 astscf_component_add_ice_libraries(ServiceLocatorStateReplicator IceStorm)
 astscf_component_add_boost_libraries(ServiceLocatorStateReplicator thread date_time)
 astscf_component_build_icebox(ServiceLocatorStateReplicator)
-target_link_libraries(ServiceLocatorStateReplicator LoggingClient)
+target_link_libraries(ServiceLocatorStateReplicator LoggingClient ASTSCFIceUtilCpp)
 astscf_component_install(ServiceLocatorStateReplicator)
diff --git a/src/ComponentStateReplicator.cpp b/src/ComponentStateReplicator.cpp
new file mode 100644
index 0000000..92dcd09
--- /dev/null
+++ b/src/ComponentStateReplicator.cpp
@@ -0,0 +1,99 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2010, 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.
+ */
+
+#include <Ice/Ice.h>
+
+#include <AsteriskSCF/Component/ComponentStateReplicator.h>
+#include <AsteriskSCF/logger.h>
+#include "ServiceLocatorStateReplicator.h"
+
+using namespace std;
+using namespace AsteriskSCF::Core;
+using namespace AsteriskSCF::Discovery;
+using namespace AsteriskSCF::Core::Discovery::V1;
+using namespace AsteriskSCF::System::Component::V1;
+using namespace AsteriskSCF::System::Logging;
+using namespace AsteriskSCF::Replication::ServiceLocator::V1;
+
+namespace
+{
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.ServiceLocatorStateReplicator");
+}
+
+class ComponentStateReplicator : public AsteriskSCF::Component::ComponentStateReplicator
+{
+public:
+    ComponentStateReplicator() :
+      AsteriskSCF::Component::ComponentStateReplicator(lg, 
+          AsteriskSCF::Replication::ServiceLocator::V1::StateReplicatorComponentCategory, 
+          false)  // if true, supports configuration
+    {
+    }
+
+    ~ComponentStateReplicator() {};
+
+    ///////////////////////////////////////////////////
+    // Required overrides
+
+    void createPrimaryServices();
+    void preparePrimaryServicesForDiscovery();
+
+private:
+    ServiceLocatorStateReplicatorIPtr mStateReplicator;
+    ServiceLocatorStateReplicatorPrx mStateReplicatorPrx;
+    LocatorRegistrationWrapperPtr mStateReplicatorRegistration;
+};
+
+static const string ServiceDiscoveryId("ServiceLocatorStateReplicatorService");
+
+/**
+ * Register this component's primary public interfaces with the Service Locator.
+ * This enables other Asterisk SCF components to locate our interfaces.
+ */
+void ComponentStateReplicator::preparePrimaryServicesForDiscovery()
+{
+    try
+    {
+        // Wrap our authentication extensions point for the Service Locator.
+        mStateReplicatorRegistration = wrapServiceForRegistration(mStateReplicatorPrx,
+                                                                  AsteriskSCF::Replication::ServiceLocator::V1::StateReplicatorDiscoveryCategory);
+        managePrimaryService(mStateReplicatorRegistration);
+    }
+    catch(const std::exception& e)
+    {
+        lg(Error) << "Unable to publish component interfaces in " << getName() << BOOST_CURRENT_FUNCTION <<
+            ". Exception: " << e.what();
+        throw; // rethrow
+    }
+}
+
+void ComponentStateReplicator::createPrimaryServices()
+{
+    // Create the state replicator servant
+    mStateReplicator = new ServiceLocatorStateReplicatorI();
+
+    mStateReplicatorPrx = ServiceLocatorStateReplicatorPrx::uncheckedCast(
+       getServiceAdapter()->add(mStateReplicator, getCommunicator()->stringToIdentity(ServiceDiscoveryId)));
+}
+
+extern "C"
+{
+ASTSCF_DLL_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
+{
+    return new ComponentStateReplicator;
+}
+}
+

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


-- 
asterisk-scf/integration/servicediscovery.git



More information about the asterisk-scf-commits mailing list