SstCloseTest() { plugins.load( "tcpsst" ); uint32 randport = 3000 + (uint32)(Sirikata::Task::LocalTime::now().raw() % 20000); mPort = boost::lexical_cast<std::string>(randport); mBytes=65536; mChunks=3; mOffset=1; mSendService = new IOServicePool(4); mSendStrand = mSendService->service()->createStrand(); mRecvService = new IOServicePool(4); mRecvStrand = mRecvService->service()->createStrand(); mListener = StreamListenerFactory::getSingleton().getDefaultConstructor()(mRecvStrand,StreamListenerFactory::getSingleton().getDefaultOptionParser()(String())); using std::tr1::placeholders::_1; using std::tr1::placeholders::_2; mListener->listen(Address("127.0.0.1",mPort),std::tr1::bind(&SstCloseTest::listenerNewStreamCallback,this,_1,_2)); mRecvService->run(); #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif }
SQLiteReadWriteTest() { plugins.load("sqlite"); }
SstTest():mCount(0),mDisconCount(0),mEndCount(0),ENDSTRING("T end"),mAbortTest(false) { Sirikata::PluginManager plugins; plugins.load( Sirikata::DynamicLibrary::filename("tcpsst") ); mPort="9142"; mServicePool = new IOServicePool(1); mListener = StreamListenerFactory::getSingleton().getDefaultConstructor()(mServicePool->service(),StreamListenerFactory::getSingleton().getDefaultOptionParser()(String())); using std::tr1::placeholders::_1; using std::tr1::placeholders::_2; mListener->listen(Address("127.0.0.1",mPort),std::tr1::bind(&SstTest::listenerNewStreamCallback,this,0,_1,_2)); mServicePool->run(); bool doUnorderedTest=true; bool doShortTest=false; if (doUnorderedTest){ mMessagesToSend.push_back("U:0"); mMessagesToSend.push_back("U:1"); mMessagesToSend.push_back("U:2"); } mMessagesToSend.push_back("T0th"); mMessagesToSend.push_back("T1st"); mMessagesToSend.push_back("T2nd"); mMessagesToSend.push_back("T3rd"); mMessagesToSend.push_back("T4th"); mMessagesToSend.push_back("T5th"); if (doUnorderedTest){ mMessagesToSend.push_back("U:3"); mMessagesToSend.push_back("U:4"); mMessagesToSend.push_back("U:5"); } mMessagesToSend.push_back("T6th"); mMessagesToSend.push_back("T7th"); mMessagesToSend.push_back("T8th"); mMessagesToSend.push_back("T9th"); if (!doShortTest) { std::string test("T"); for (unsigned int i=0;i<16385;++i) { test+=(char)((i+5)%128); } mMessagesToSend.push_back(test); if (doUnorderedTest){ test[0]='U'; mMessagesToSend.push_back(test); } for (unsigned int i=0;i<256*1024;++i) { test+=(char)((rand())%256); } if (doUnorderedTest){ mMessagesToSend.push_back(test); } test[0]='T'; mMessagesToSend.push_back(test); int pattern[40]={127,257,511,65537,129,16383,254,255,16384,256,16385,32767,1440,32768,32769,65535,65536,1401,1399,1280, 228,25215,5141,627,151,1,4,124240,3,296,114385,25,17,47,42,24222,655,1441,1439,1024}; for (size_t i=0;i<sizeof(pattern)/sizeof(pattern[0]);++i) { std::string pat="T"; for (int j=0;j<pattern[i];++j) { pat+='~'-(i%((pattern[i]%90)+3)); } mMessagesToSend.push_back(pat); pat[0]='U'; mMessagesToSend.push_back(pat); } mMessagesToSend.push_back("T_0th"); mMessagesToSend.push_back("T_1st"); mMessagesToSend.push_back("T_2nd"); mMessagesToSend.push_back("T_3rd"); mMessagesToSend.push_back("T_4th"); mMessagesToSend.push_back("T_5th"); if (doUnorderedTest){ mMessagesToSend.push_back("U:6"); mMessagesToSend.push_back("U:7"); mMessagesToSend.push_back("U:8"); mMessagesToSend.push_back("U:9"); mMessagesToSend.push_back("U:A"); } mMessagesToSend.push_back("T_6th"); mMessagesToSend.push_back("T_7th"); if (doUnorderedTest){ mMessagesToSend.push_back("U:B"); } mMessagesToSend.push_back("T_8th"); if (doUnorderedTest){ mMessagesToSend.push_back("U:C"); } mMessagesToSend.push_back("T_9th"); if (doUnorderedTest){ mMessagesToSend.push_back("U:D"); } mMessagesToSend.push_back("The green grasshopper fetched."); if (doUnorderedTest){ mMessagesToSend.push_back("U:E"); mMessagesToSend.push_back("U:F"); mMessagesToSend.push_back("U:G"); } mMessagesToSend.push_back("T A blade of grass."); mMessagesToSend.push_back("T From the playground ."); mMessagesToSend.push_back("T Grounds test test test this is a test test test this is a test test test this is a test test test test and the test is proceeding until it reaches signific length with a string that long however. this is not quite long enough to trigger the high water mark--well now it is I believe to the best of my abilities"); mMessagesToSend.push_back("T Grounds test test test this is a test test test this is a test test test this is a test test test test and the test is proceeding until it reaches signific length with a string that long however. this is not quite"); if (doUnorderedTest){ mMessagesToSend.push_back("U:H"); mMessagesToSend.push_back("U:I"); mMessagesToSend.push_back("U:J"); mMessagesToSend.push_back("U:K"); mMessagesToSend.push_back("U:L"); mMessagesToSend.push_back("U:M"); mMessagesToSend.push_back("U:N"); mMessagesToSend.push_back("U:O"); mMessagesToSend.push_back("U:P"); mMessagesToSend.push_back("U:Q"); } } mMessagesToSend.push_back(ENDSTRING); }
SQLiteMinitransactionTest() { Sirikata::PluginManager plugins; plugins.load(Sirikata::DynamicLibrary::filename("sqlite")); mDatabase=createMinitransactionalHandlerFunction(""); }