diff options
| author | Alan Conway <aconway@apache.org> | 2013-01-14 19:08:45 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2013-01-14 19:08:45 +0000 |
| commit | 5f8b1444a339d6932720f4817145a04136773302 (patch) | |
| tree | 8f446b7bfdf305faeac4c9d0103d51de30ca3850 /cpp/src/tests | |
| parent | 3788386fe0c3d211bbeab4da9d22b7be65429a20 (diff) | |
| download | qpid-python-5f8b1444a339d6932720f4817145a04136773302.tar.gz | |
QPID-4514: Clean up cluster code: Obsolete management import/export functions.
Remove management fucntions used to import/export data from the cluster module.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1433054 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
| -rw-r--r-- | cpp/src/tests/BrokerMgmtAgent.cpp | 355 |
1 files changed, 0 insertions, 355 deletions
diff --git a/cpp/src/tests/BrokerMgmtAgent.cpp b/cpp/src/tests/BrokerMgmtAgent.cpp index a562958ea2..29c3faf809 100644 --- a/cpp/src/tests/BrokerMgmtAgent.cpp +++ b/cpp/src/tests/BrokerMgmtAgent.cpp @@ -324,361 +324,6 @@ QPID_AUTO_TEST_CASE(v2ObjPublish) delete tm; } - -// verify that a deleted object is exported correctly using the -// exportDeletedObjects() method. V1 testcase. -// -QPID_AUTO_TEST_CASE(v1ExportDelObj) -{ - AgentFixture* fix = new AgentFixture(3); - management::ManagementAgent* agent; - agent = fix->getBrokerAgent(); - - // create a manageable test object - TestManageable *tm = new TestManageable(agent, std::string("myObj")); - uint32_t objLen = tm->GetManagementObject()->writePropertiesSize(); - - Receiver r1 = fix->createV1DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - - agent->addObject(tm->GetManagementObject(), 1); - - // wait for the object to be published - Message m1; - BOOST_CHECK(r1.fetch(m1, Duration::SECOND * 6)); - - TestObjectVector objs; - decodeV1ObjectUpdates(m1, objs, objLen); - BOOST_CHECK(objs.size() > 0); - - // destroy the object, then immediately export (before the next poll cycle) - - ::qpid::management::ManagementAgent::DeletedObjectList delObjs; - tm->GetManagementObject()->resourceDestroy(); - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 1); - - // wait for the deleted object to be published - - bool isDeleted = false; - while (!isDeleted && r1.fetch(m1, Duration::SECOND * 6)) { - - decodeV1ObjectUpdates(m1, objs, objLen); - BOOST_CHECK(objs.size() > 0); - - for (TestObjectVector::iterator oIter = objs.begin(); oIter != objs.end(); oIter++) { - - TestManageable::validateTestObjectProperties(**oIter); - - qpid::types::Variant::Map mappy; - (*oIter)->writeTimestamps(mappy); - if (mappy["_delete_ts"].asUint64() != 0) - isDeleted = true; - } - } - - BOOST_CHECK(isDeleted); - - // verify there are no deleted objects to export now. - - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 0); - - r1.close(); - delete fix; - delete tm; -} - - -// verify that a deleted object is imported correctly using the -// importDeletedObjects() method. V1 testcase. -// -QPID_AUTO_TEST_CASE(v1ImportDelObj) -{ - AgentFixture* fix = new AgentFixture(3); - management::ManagementAgent* agent; - agent = fix->getBrokerAgent(); - - // create a manageable test object - TestManageable *tm = new TestManageable(agent, std::string("anObj")); - uint32_t objLen = tm->GetManagementObject()->writePropertiesSize(); - - Receiver r1 = fix->createV1DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - - agent->addObject(tm->GetManagementObject(), 1); - - // wait for the object to be published - Message m1; - BOOST_CHECK(r1.fetch(m1, Duration::SECOND * 6)); - - TestObjectVector objs; - decodeV1ObjectUpdates(m1, objs, objLen); - BOOST_CHECK(objs.size() > 0); - - // destroy the object, then immediately export (before the next poll cycle) - - ::qpid::management::ManagementAgent::DeletedObjectList delObjs; - tm->GetManagementObject()->resourceDestroy(); - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 1); - - // destroy the broker, and reinistantiate a new one without populating it - // with a TestObject. - - r1.close(); - delete fix; - delete tm; // should no longer be necessary - - fix = new AgentFixture(3); - r1 = fix->createV1DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - agent = fix->getBrokerAgent(); - agent->importDeletedObjects( delObjs ); - - // wait for the deleted object to be published - - bool isDeleted = false; - while (!isDeleted && r1.fetch(m1, Duration::SECOND * 6)) { - - decodeV1ObjectUpdates(m1, objs, objLen); - BOOST_CHECK(objs.size() > 0); - - for (TestObjectVector::iterator oIter = objs.begin(); oIter != objs.end(); oIter++) { - - TestManageable::validateTestObjectProperties(**oIter); - - qpid::types::Variant::Map mappy; - (*oIter)->writeTimestamps(mappy); - if (mappy["_delete_ts"].asUint64() != 0) - isDeleted = true; - } - } - - BOOST_CHECK(isDeleted); - - // verify there are no deleted objects to export now. - - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 0); - - r1.close(); - delete fix; -} - - -// verify that an object that is added and deleted prior to the -// first poll cycle is accounted for by the export -// -QPID_AUTO_TEST_CASE(v1ExportFastDelObj) -{ - AgentFixture* fix = new AgentFixture(3); - management::ManagementAgent* agent; - agent = fix->getBrokerAgent(); - - // create a manageable test object - TestManageable *tm = new TestManageable(agent, std::string("objectifyMe")); - - // add, then immediately delete and export the object... - - ::qpid::management::ManagementAgent::DeletedObjectList delObjs; - agent->addObject(tm->GetManagementObject(), 999); - tm->GetManagementObject()->resourceDestroy(); - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 1); - - delete fix; - delete tm; -} - - -// Verify that we can export and import multiple deleted objects correctly. -// -QPID_AUTO_TEST_CASE(v1ImportMultiDelObj) -{ - AgentFixture* fix = new AgentFixture(3); - management::ManagementAgent* agent; - agent = fix->getBrokerAgent(); - - Receiver r1 = fix->createV1DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - - // populate the agent with multiple test objects - const size_t objCount = 50; - std::vector<TestManageable *> tmv; - uint32_t objLen; - - for (size_t i = 0; i < objCount; i++) { - std::stringstream key; - key << "testobj-" << std::setfill('x') << std::setw(4) << i; - // (no, seriously, I didn't just do that.) - // Note well: we have to keep the key string length EXACTLY THE SAME - // FOR ALL OBJECTS, so objLen will be the same. Otherwise the - // decodeV1ObjectUpdates() will fail (v1 lacks explict encoded length). - TestManageable *tm = new TestManageable(agent, key.str()); - objLen = tm->GetManagementObject()->writePropertiesSize(); - agent->addObject(tm->GetManagementObject(), i + 1); - tmv.push_back(tm); - } - - // wait for the objects to be published - Message m1; - uint32_t msgCount = 0; - while(r1.fetch(m1, Duration::SECOND * 6)) { - TestObjectVector objs; - decodeV1ObjectUpdates(m1, objs, objLen); - msgCount += objs.size(); - } - - BOOST_CHECK_EQUAL(msgCount, objCount); - - // destroy some of the objects, then immediately export (before the next poll cycle) - - uint32_t delCount = 0; - for (size_t i = 0; i < objCount; i += 2) { - tmv[i]->GetManagementObject()->resourceDestroy(); - delCount++; - } - - ::qpid::management::ManagementAgent::DeletedObjectList delObjs; - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK_EQUAL(delObjs.size(), delCount); - - // destroy the broker, and reinistantiate a new one without populating it - // with TestObjects. - - r1.close(); - delete fix; - while (tmv.size()) { - delete tmv.back(); - tmv.pop_back(); - } - - fix = new AgentFixture(3); - r1 = fix->createV1DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - agent = fix->getBrokerAgent(); - agent->importDeletedObjects( delObjs ); - - // wait for the deleted object to be published, verify the count - - uint32_t countDels = 0; - while (r1.fetch(m1, Duration::SECOND * 6)) { - TestObjectVector objs; - decodeV1ObjectUpdates(m1, objs, objLen); - BOOST_CHECK(objs.size() > 0); - - - for (TestObjectVector::iterator oIter = objs.begin(); oIter != objs.end(); oIter++) { - - TestManageable::validateTestObjectProperties(**oIter); - - qpid::types::Variant::Map mappy; - (*oIter)->writeTimestamps(mappy); - if (mappy["_delete_ts"].asUint64() != 0) - countDels++; - } - } - - // make sure we get the correct # of deleted objects - BOOST_CHECK_EQUAL(countDels, delCount); - - // verify there are no deleted objects to export now. - - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 0); - - r1.close(); - delete fix; -} - -// Verify that we can export and import multiple deleted objects correctly. -// QMF V2 variant -QPID_AUTO_TEST_CASE(v2ImportMultiDelObj) -{ - AgentFixture* fix = new AgentFixture(3, true); - management::ManagementAgent* agent; - agent = fix->getBrokerAgent(); - - Receiver r1 = fix->createV2DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - - // populate the agent with multiple test objects - const size_t objCount = 50; - std::vector<TestManageable *> tmv; - - for (size_t i = 0; i < objCount; i++) { - std::stringstream key; - key << "testobj-" << i; - TestManageable *tm = new TestManageable(agent, key.str()); - if (tm->GetManagementObject()->writePropertiesSize()) {} - agent->addObject(tm->GetManagementObject(), key.str()); - tmv.push_back(tm); - } - - // wait for the objects to be published - Message m1; - uint32_t msgCount = 0; - while(r1.fetch(m1, Duration::SECOND * 6)) { - TestObjectVector objs; - decodeV2ObjectUpdates(m1, objs); - msgCount += objs.size(); - } - - BOOST_CHECK_EQUAL(msgCount, objCount); - - // destroy some of the objects, then immediately export (before the next poll cycle) - - uint32_t delCount = 0; - for (size_t i = 0; i < objCount; i += 2) { - tmv[i]->GetManagementObject()->resourceDestroy(); - delCount++; - } - - ::qpid::management::ManagementAgent::DeletedObjectList delObjs; - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK_EQUAL(delObjs.size(), delCount); - - // destroy the broker, and reinistantiate a new one without populating it - // with TestObjects. - - r1.close(); - delete fix; - while (tmv.size()) { - delete tmv.back(); - tmv.pop_back(); - } - - fix = new AgentFixture(3, true); - r1 = fix->createV2DataIndRcvr("org.apache.qpid.broker.mgmt.test", "#"); - agent = fix->getBrokerAgent(); - agent->importDeletedObjects( delObjs ); - - // wait for the deleted object to be published, verify the count - - uint32_t countDels = 0; - while (r1.fetch(m1, Duration::SECOND * 6)) { - TestObjectVector objs; - decodeV2ObjectUpdates(m1, objs); - BOOST_CHECK(objs.size() > 0); - - for (TestObjectVector::iterator oIter = objs.begin(); oIter != objs.end(); oIter++) { - - TestManageable::validateTestObjectProperties(**oIter); - - qpid::types::Variant::Map mappy; - (*oIter)->writeTimestamps(mappy); - if (mappy["_delete_ts"].asUint64() != 0) - countDels++; - } - } - - // make sure we get the correct # of deleted objects - BOOST_CHECK_EQUAL(countDels, delCount); - - // verify there are no deleted objects to export now. - - agent->exportDeletedObjects( delObjs ); - BOOST_CHECK(delObjs.size() == 0); - - r1.close(); - delete fix; -} - // See QPID-2997 QPID_AUTO_TEST_CASE(v2RapidRestoreObj) { |
