diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/test/Ice/objects/AllTests.cpp | 99 | ||||
-rw-r--r-- | cpp/test/Ice/objects/Client.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/objects/Collocated.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.cpp | 4 |
4 files changed, 80 insertions, 31 deletions
diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp index a3541931c0f..4c9219e9145 100644 --- a/cpp/test/Ice/objects/AllTests.cpp +++ b/cpp/test/Ice/objects/AllTests.cpp @@ -15,7 +15,7 @@ using namespace std; InitialPrx -allTests(const Ice::CommunicatorPtr& communicator) +allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { cout << "testing stringToProxy... " << flush; string ref("initial:tcp -p 12345 -t 2000"); @@ -68,6 +68,36 @@ allTests(const Ice::CommunicatorPtr& communicator) test(d->c == 0); cout << "ok" << endl; + // + // Break cyclic dependencies + // + if (!collocated) + { + BPtr::dynamicCast(b1->a)->a = 0; + BPtr::dynamicCast(b1->a)->b = 0; + BPtr::dynamicCast(b1->a)->c = 0; + b1->a = 0; + b1->b = 0; + + b2->a = 0; + b2->b->a = 0; + b2->b->b = 0; + b2->c = 0; + + c->b->a = 0; + c->b->b->a = 0; + c->b->b->b = 0; + c->b = 0; + + BPtr::dynamicCast(BPtr::dynamicCast(d->a)->a)->a = 0; + BPtr::dynamicCast(BPtr::dynamicCast(d->a)->a)->b = 0; + BPtr::dynamicCast(d->a)->b->a = 0; + BPtr::dynamicCast(d->a)->b->b = 0; + d->b->a = 0; + d->b->b = 0; + d->b->c = 0; + } + cout << "getting B1, B2, C, and D all at once... " << flush; initial->getAll(b1, b2, c, d); test(b1); @@ -95,6 +125,21 @@ allTests(const Ice::CommunicatorPtr& communicator) test(d->c == 0); cout << "ok" << endl; + // + // Break cyclic dependencies + // + if (!collocated) + { + b1->a = 0; + b1->b = 0; + b2->a = 0; + b2->b = 0; + b2->c = 0; + c->b = 0; + d->a = 0; + d->b = 0; + } + cout << "adding facets to B1... " << flush; initial->addFacetsToB1(); cout << "ok" << endl; @@ -136,6 +181,24 @@ allTests(const Ice::CommunicatorPtr& communicator) test(fd->c == 0); cout << "ok" << endl; + // + // Break cyclic dependencies + // + if (!collocated) + { + BPtr::dynamicCast(fb1->a)->a = 0; + BPtr::dynamicCast(fb1->a)->b = 0; + fb1->a = 0; + fb1->b = 0; + fb1->_removeAllFacets(); + fb2->a = 0; + fb2->b = 0; + fb2->c = 0; + fc->b = 0; + fd->a = 0; + fd->b = 0; + } + cout << "getting B1 with facets, and B2, C, and D all at once... " << flush; initial->getAll(b1, b2, c, d); test(b1); @@ -192,28 +255,18 @@ allTests(const Ice::CommunicatorPtr& communicator) // // Break cyclic dependencies // - b1->a = 0; - b1->b = 0; - b1->c = 0; - b1->_removeAllFacets(); - b1 = 0; - fb1 = 0; - b2->a = 0; - b2->b = 0; - b2->c = 0; - b2->_removeAllFacets(); - b2 = 0; - fb2 = 0; - c->b = 0; - c->_removeAllFacets(); - c = 0; - fc = 0; - d->a = 0; - d->b = 0; - d->c = 0; - d->_removeAllFacets(); - d = 0; - fd = 0; + if (!collocated) + { + fb1->a = 0; + fb1->b = 0; + fb1->_removeAllFacets(); + fb2->a = 0; + fb2->b = 0; + fb2->c = 0; + fc->b = 0; + fd->a = 0; + fd->b = 0; + } return initial; } diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp index 2c7f2b27ccd..b6226000e78 100644 --- a/cpp/test/Ice/objects/Client.cpp +++ b/cpp/test/Ice/objects/Client.cpp @@ -50,8 +50,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) communicator->addObjectFactory(factory, "::C"); communicator->addObjectFactory(factory, "::D"); - InitialPrx allTests(const Ice::CommunicatorPtr&); - InitialPrx initial = allTests(communicator); + InitialPrx allTests(const Ice::CommunicatorPtr&, bool); + InitialPrx initial = allTests(communicator, false); initial->shutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp index 7d216fe9d2e..99dfb5fa6fc 100644 --- a/cpp/test/Ice/objects/Collocated.cpp +++ b/cpp/test/Ice/objects/Collocated.cpp @@ -20,8 +20,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); InitialPtr initial = new InitialI(adapter); adapter->add(initial, "initial"); - InitialPrx allTests(const Ice::CommunicatorPtr&); - allTests(communicator); + InitialPrx allTests(const Ice::CommunicatorPtr&, bool); + initial->shutdown(); // We must call shutdown even in the collocated case for cyclic dependency cleanup return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp index 495e0c67e9f..b3962d8bfb7 100644 --- a/cpp/test/Ice/objects/TestI.cpp +++ b/cpp/test/Ice/objects/TestI.cpp @@ -45,20 +45,16 @@ InitialI::shutdown() _b1->b = 0; _b1->c = 0; _b1->_removeAllFacets(); - _b1 = 0; _b2->a = 0; _b2->b = 0; _b2->c = 0; _b2->_removeAllFacets(); - _b2 = 0; _c->b = 0; _c->_removeAllFacets(); - _c = 0; _d->a = 0; _d->b = 0; _d->c = 0; _d->_removeAllFacets(); - _d = 0; } BPtr |