summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/operations/BatchOneways.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/operations/BatchOneways.cpp')
-rw-r--r--cpp/test/Ice/operations/BatchOneways.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/cpp/test/Ice/operations/BatchOneways.cpp b/cpp/test/Ice/operations/BatchOneways.cpp
index 8d6bfffad21..969d772bd58 100644
--- a/cpp/test/Ice/operations/BatchOneways.cpp
+++ b/cpp/test/Ice/operations/BatchOneways.cpp
@@ -39,7 +39,11 @@ public:
if(_size + request.getSize() > 25000)
{
+#ifdef ICE_CPP11_MAPPING
+ request.getProxy()->ice_flushBatchRequests_async();
+#else
request.getProxy()->begin_ice_flushBatchRequests();
+#endif
_size = 18; // header
}
@@ -70,16 +74,16 @@ private:
int _size;
int _lastRequestSize;
};
-typedef IceUtil::Handle<BatchRequestInterceptorI> BatchRequestInterceptorIPtr;
+ICE_DEFINE_PTR(BatchRequestInterceptorIPtr, BatchRequestInterceptorI);
}
void
-batchOneways(const Test::MyClassPrx& p)
+batchOneways(const Test::MyClassPrxPtr& p)
{
const Test::ByteS bs1(10 * 1024);
- Test::MyClassPrx batch = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway());
+ Test::MyClassPrxPtr batch = ICE_UNCHECKED_CAST(Test::MyClassPrx, p->ice_batchOneway());
batch->ice_flushBatchRequests(); // Empty flush
@@ -91,8 +95,9 @@ batchOneways(const Test::MyClassPrx& p)
{
batch->opByteSOneway(bs1);
}
- catch(const Ice::LocalException&)
+ catch(const Ice::LocalException& ex)
{
+ cerr << ex << endl;
test(false);
}
}
@@ -104,10 +109,11 @@ batchOneways(const Test::MyClassPrx& p)
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
}
- if(batch->ice_getConnection())
+ if(batch->ice_getConnection() &&
+ p->ice_getCommunicator()->getProperties()->getProperty("Ice.Default.Protocol") != "bt")
{
- Test::MyClassPrx batch1 = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway());
- Test::MyClassPrx batch2 = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway());
+ Test::MyClassPrxPtr batch1 = ICE_UNCHECKED_CAST(Test::MyClassPrx, p->ice_batchOneway());
+ Test::MyClassPrxPtr batch2 = ICE_UNCHECKED_CAST(Test::MyClassPrx, p->ice_batchOneway());
batch1->ice_ping();
batch2->ice_ping();
@@ -127,7 +133,7 @@ batchOneways(const Test::MyClassPrx& p)
Ice::Identity identity;
identity.name = "invalid";
- Ice::ObjectPrx batch3 = batch->ice_identity(identity);
+ Ice::ObjectPrxPtr batch3 = batch->ice_identity(identity);
batch3->ice_ping();
batch3->ice_flushBatchRequests();
@@ -137,26 +143,26 @@ batchOneways(const Test::MyClassPrx& p)
batch->ice_flushBatchRequests();
batch->ice_ping();
- if(batch->ice_getConnection())
+ if(batch->ice_getConnection() &&
+ p->ice_getCommunicator()->getProperties()->getProperty("Ice.Default.Protocol") != "bt")
{
Ice::InitializationData initData;
initData.properties = p->ice_getCommunicator()->getProperties()->clone();
- BatchRequestInterceptorIPtr interceptor = new BatchRequestInterceptorI;
+ BatchRequestInterceptorIPtr interceptor = ICE_MAKE_SHARED(BatchRequestInterceptorI);
-#ifdef ICE_CPP11
- // Ensure lambda factory method works.
- initData.batchRequestInterceptor = Ice::newBatchRequestInterceptor(
+#if defined(ICE_CPP11_MAPPING)
+ initData.batchRequestInterceptor =
[=](const Ice::BatchRequest& request, int count, int size)
{
interceptor->enqueue(request, count, size);
- });
+ };
#else
initData.batchRequestInterceptor = interceptor;
#endif
Ice::CommunicatorPtr ic = Ice::initialize(initData);
- Test::MyClassPrx batch =
- Test::MyClassPrx::uncheckedCast(ic->stringToProxy(p->ice_toString()))->ice_batchOneway();
+ Test::MyClassPrxPtr batch =
+ ICE_UNCHECKED_CAST(Test::MyClassPrx, ic->stringToProxy(p->ice_toString()))->ice_batchOneway();
test(interceptor->count() == 0);
batch->ice_ping();