2009-05-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added changeGlobalOption command. Currently,
	max-overall-download-limit and max-overall-upload-limit option are
	available.
	* src/RequestGroupMan.h
	* src/XmlRpcMethod.cc
	* src/XmlRpcMethod.h
	* src/XmlRpcMethodFactory.cc
	* src/XmlRpcMethodImpl.cc
	* src/XmlRpcMethodImpl.h
	* test/XmlRpcMethodTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2009-05-14 15:44:59 +00:00
parent 850458f7b1
commit 3e2ccbf359
8 changed files with 103 additions and 1 deletions

View file

@ -25,6 +25,7 @@ class XmlRpcMethodTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(XmlRpcMethodTest);
CPPUNIT_TEST(testAddUri);
CPPUNIT_TEST(testChangeOption);
CPPUNIT_TEST(testChangeGlobalOption);
CPPUNIT_TEST(testNoSuchMethod);
CPPUNIT_TEST_SUITE_END();
private:
@ -46,6 +47,7 @@ public:
void testAddUri();
void testChangeOption();
void testChangeGlobalOption();
void testNoSuchMethod();
};
@ -88,6 +90,23 @@ void XmlRpcMethodTest::testChangeOption()
CPPUNIT_ASSERT_EQUAL((unsigned int)50*1024, group->getMaxUploadSpeedLimit());
}
void XmlRpcMethodTest::testChangeGlobalOption()
{
ChangeGlobalOptionXmlRpcMethod m;
XmlRpcRequest req("aria2.changeGlobalOption", BDE::list());
BDE opt = BDE::dict();
opt[PREF_MAX_OVERALL_DOWNLOAD_LIMIT] = BDE("100K");
opt[PREF_MAX_OVERALL_UPLOAD_LIMIT] = BDE("50K");
req._params << opt;
XmlRpcResponse res = m.execute(req, _e.get());
CPPUNIT_ASSERT_EQUAL(0, res._code);
CPPUNIT_ASSERT_EQUAL((unsigned int)100*1024,
_e->_requestGroupMan->getMaxOverallDownloadSpeedLimit());
CPPUNIT_ASSERT_EQUAL((unsigned int)50*1024,
_e->_requestGroupMan->getMaxOverallUploadSpeedLimit());
}
void XmlRpcMethodTest::testNoSuchMethod()
{
NoSuchMethodXmlRpcMethod m;