[asterisk-scf-commits] asterisk-scf/integration/media_transport_udptl.git branch "retry_deux" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Apr 30 18:56:41 CDT 2012
branch "retry_deux" has been updated
via 92305fd3dfb912051e084622f4b762f1a0487ce0 (commit)
from 657df2d9526e90cfa0a8a72c061b805c7982693b (commit)
Summary of changes:
config/test_component.config | 2 ++
config/test_component_v6.config | 3 +++
config/test_udptl_ice.conf | 6 ++++++
src/Component.cpp | 12 ++++++++++++
test/TestMediaTransportUDPTL.cpp | 22 +++++++++++++++++++++-
test/TestUDPTLICE.cpp | 29 +++++++++++++++++++++++++++++
6 files changed, 73 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 92305fd3dfb912051e084622f4b762f1a0487ce0
Author: Ken Hunt <ken.hunt at digium.com>
Date: Mon Apr 30 18:56:14 2012 -0500
Corrected behavior when starting in standby mode, and added activation of the component in the unit tests.
diff --git a/config/test_component.config b/config/test_component.config
index f7fc24e..e012797 100644
--- a/config/test_component.config
+++ b/config/test_component.config
@@ -46,6 +46,8 @@ IceBox.Service.TestMediaTransportUDPTL=MediaTransportUDPTLTest:create
IceBox.Service.ServiceDiscovery=ServiceLocator:create
+ServiceDiscovery.Standalone = true
+
ServiceDiscovery.IceStorm.InstanceName=ServiceDiscovery
ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -h 127.0.0.1 -p 10000
ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -h 127.0.0.1 -p 10001:udp -h 127.0.0.1 -p 10001
diff --git a/config/test_component_v6.config b/config/test_component_v6.config
index 2a04fed..52d0216 100644
--- a/config/test_component_v6.config
+++ b/config/test_component_v6.config
@@ -46,6 +46,9 @@ IceBox.Service.TestMediaTransportUDPTL=MediaTransportUDPTLTestV6:create
IceBox.Service.ServiceDiscovery=ServiceLocator:create
+# For unit test we run without state replication.
+ServiceDiscovery.Standalone = true
+
ServiceDiscovery.IceStorm.InstanceName=ServiceDiscovery
ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -h 127.0.0.1 -p 10000
ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -h 127.0.0.1 -p 10001:udp -h 127.0.0.1 -p 10001
diff --git a/config/test_udptl_ice.conf b/config/test_udptl_ice.conf
index dda8453..95054b6 100644
--- a/config/test_udptl_ice.conf
+++ b/config/test_udptl_ice.conf
@@ -14,6 +14,9 @@ IceBox.LoadOrder=ServiceDiscovery,UDPTLStateReplicator,MediaTransportUDPTL,TestM
# RtpStateReplicator Configuration
IceBox.Service.UDPTLStateReplicator=UDPTLStateReplicator:create
+# For unit testing, we run without state replicator
+UDPTLStateReplicator.Standalone = true
+
# Adapter parameters for this component
UDPTLStateReplicator.Adapter.Endpoints=tcp -h 127.0.0.1:udp -h 127.0.0.1
@@ -48,6 +51,9 @@ IceBox.Service.TestMediaTransportUDPTL=MediaTransportUDPTLIceTest:create
IceBox.Service.ServiceDiscovery=ServiceLocator:create
+# For unit testing we run without state replicator.
+ServiceDiscovery.Standalone = true
+
ServiceDiscovery.IceStorm.InstanceName=ServiceDiscovery
ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -h 127.0.0.1 -p 10000
ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -h 127.0.0.1 -p 10001:udp -h 127.0.0.1 -p 10001
diff --git a/src/Component.cpp b/src/Component.cpp
index 4e8c7b9..260e230 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -161,6 +161,7 @@ private:
virtual void onPreInitialize();
virtual void onStop();
virtual void onStart();
+ virtual void onActivated();
// Other base Component overrides
virtual void prepareBackplaneServicesForDiscovery();
@@ -492,6 +493,17 @@ void Component::onRegisterPrimaryServices()
mGeneralState->serviceManagement->addLocatorParams(AsteriskSCF::Operations::createContext(), mUdptlLocatorParams, "");
}
+void Component::onActivated()
+{
+ UdptlReplicationContextPtr udptlReplicationContext =
+ boost::static_pointer_cast<UdptlReplicationContext>(getReplicationContext());
+
+ UdptlStateItemSeq items;
+ items.push_back(mGeneralState);
+ UdptlStateReplicatorPrx oneway = UdptlStateReplicatorPrx::uncheckedCast(udptlReplicationContext->getReplicator()->ice_oneway());
+ oneway->setState(AsteriskSCF::Operations::createContext(), items);
+}
+
void Component::onStart()
{
if (getReplicationContext()->isReplicating() == true)
diff --git a/test/TestMediaTransportUDPTL.cpp b/test/TestMediaTransportUDPTL.cpp
index de5471a..ba58567 100644
--- a/test/TestMediaTransportUDPTL.cpp
+++ b/test/TestMediaTransportUDPTL.cpp
@@ -36,6 +36,7 @@
#include <AsteriskSCF/Media/UDPTL/MediaUDPTLIf.h>
#include <AsteriskSCF/Media/NetworkIf.h>
#include <AsteriskSCF/Operations/OperationContext.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include "UdptlStateReplicationIf.h"
@@ -46,6 +47,7 @@ using namespace AsteriskSCF::Media::V1;
using namespace AsteriskSCF::Media::UDPTL::V1;
using namespace AsteriskSCF::Replication::UDPTL::V1;
using namespace AsteriskSCF::Network::V1;
+using namespace AsteriskSCF::System::Component::V1;
/**
* Test service, for loading into icebox
@@ -287,9 +289,27 @@ struct GlobalIceFixture
Testbed.locator = ServiceLocatorPrx::checkedCast(Testbed.communicator->stringToProxy("LocatorService:tcp -h 127.0.0.1 -p 4411"));
- if (!Testbed.locator) {
+ if (!Testbed.locator)
+ {
throw "Invalid service locator proxy";
}
+
+ ServiceLocatorParamsPtr primaryReplicaParams(new ServiceLocatorParams);
+ primaryReplicaParams->category = "MediaUDPTLService.Replica";
+ primaryReplicaParams->service = "default";
+ primaryReplicaParams->id = "MediaTransportUDPTL";
+
+ ReplicaPrx mPrimaryReplica;
+ try
+ {
+ mPrimaryReplica = ReplicaPrx::uncheckedCast(Testbed.locator->locate(primaryReplicaParams));
+ }
+ catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
+ {
+ throw;
+ }
+
+ mPrimaryReplica->activate(AsteriskSCF::Operations::createContext());
}
catch (const Ice::Exception& ex)
{
diff --git a/test/TestUDPTLICE.cpp b/test/TestUDPTLICE.cpp
index dea0b3a..596f5bf 100644
--- a/test/TestUDPTLICE.cpp
+++ b/test/TestUDPTLICE.cpp
@@ -34,6 +34,7 @@
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/UDPTL/MediaUDPTLIf.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
//
// An attempt to get some reasonable code coverage and verify that the basic *premise* of the functionality works as
@@ -49,6 +50,8 @@ using namespace AsteriskSCF::Media::UDPTL::V1;
using namespace AsteriskSCF::System::Configuration::V1;
using namespace AsteriskSCF::Replication::UDPTL::V1;
using namespace AsteriskSCF::Configuration::UDPTL::V1;
+using namespace AsteriskSCF::System::Component::V1;
+using namespace AsteriskSCF::Core::Discovery::V1;
namespace
{
@@ -115,6 +118,32 @@ public:
BOOST_TEST_MESSAGE("Creating test fixture");
::boost::debug::detect_memory_leaks(false);
::boost::unit_test::unit_test_log.set_stream(cout);
+
+ IceEnvironment iceEnv;
+
+ ServiceLocatorPrx locator = ServiceLocatorPrx::checkedCast(iceEnv.getCommunicator()->stringToProxy("LocatorService:tcp -h 127.0.0.1 -p 4411"));
+
+ if (!locator)
+ {
+ throw "Invalid service locator proxy";
+ }
+
+ ServiceLocatorParamsPtr primaryReplicaParams(new ServiceLocatorParams);
+ primaryReplicaParams->category = "MediaUDPTLService.Replica";
+ primaryReplicaParams->service = "default";
+ primaryReplicaParams->id = "MediaTransportUDPTL";
+
+ ReplicaPrx mPrimaryReplica;
+ try
+ {
+ mPrimaryReplica = ReplicaPrx::uncheckedCast(locator->locate(primaryReplicaParams));
+ }
+ catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
+ {
+ throw;
+ }
+
+ mPrimaryReplica->activate(AsteriskSCF::Operations::createContext());
}
~TestFixture()
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_transport_udptl.git
More information about the asterisk-scf-commits
mailing list