#define MD_AUSREG #include "cliever-md.h" #include "session/SessionFactory.hpp" #include "session/SessionManagerProperties.hpp" #include "session/Transaction.hpp" #include "common/SystemProperties.hpp" #include "session/Session.hpp" #include "session/StatsManager.hpp" #include "se/DomainCheckCommand.hpp" #include "se/DomainCheckResponse.hpp" #include "se/LPE/LPChkCmdExtension.hpp" #include "se/LPE/LPChkRespExtension.hpp" #include "se/LPE/LPCrtCmdExtension.hpp" #include "se/LPE/LPCrtRespExtension.hpp" #include "se/TransferOp.hpp" #include "se/IntPostalInfo.hpp" #include "se/ContactCreateCommand.hpp" #include "se/ContactCreateResponse.hpp" #include "se/DomainCreateCommand.hpp" #include "se/DomainCreateResponse.hpp" #include "se/DomainTransferApproveCommand.hpp" #include "se/DomainTransferRequestCommand.hpp" #include "se/DomainTransferResponse.hpp" using namespace std; //class RRJPI : public PostalInfo { // public: // RRJPI(const PostalInfoType *type,const string& name, const string& org, // const std::vector& street, const string& city, // const string& state,const string& pc, const string& guo) // : PostalInfo (type, name, org, street, city, state, pc, guo) { }; //}; char *name1 = "bestever.camera"; // char *name2 = "yoda.guru"; char *name3 = "pricey.holdings"; // char *name4 = "unicycles.bike"; char *name5 = "greedy.ventures"; // char *name6 = "shady.ventures"; // char *name7 = "hemmarhoid.camera"; // static TestEnvironment props; static std::string TEST_SE = ""; // static void testExecuteParallelTransactions() throw (EPPException); bool ausRegEPPTK::doNothing(const std::string propertiesFilePath) { // Just verify load bool did=false; try { scenario( 0, propertiesFilePath ); // tkScenario 0 assumed did = true; } catch(std::exception &e) { theseLogs->logN(2,"Scenario %d TK Exception: %s .",tkScenario,e.what()); } return did; } void ausRegEPPTK::doOTEA() { int hours,hoops; string op("newInstance"); scenario(tkScenario,thisConfig->cfg_path); try { Timer::setTime("20140101.010101"); auto_ptr manager(SessionManagerFactory::newInstance(&props)); auto_ptr sess(SessionFactory::newInstance(&props)); op = "startup"; manager->startup(); op = "run (keep-alive)"; manager->run(); sess->open(); for (hours=0;hours < 24;hours++) { // Spawn the keep alive thread. theseLogs->logN(1,"Send Test SEs on or about start OTE Test Hour %d.",hours); for (hoops=0;hoops<7;hoops++) { sess->writeXML(TEST_SE); sess->read(); sleep(857); } } sess->close(); manager->shutdown(); } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"EPP Exception during OTE A (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(2,"General Exception during OTE A (%s).",op.c_str()); } } void ausRegEPPTK::doOTEB() { bool addDomains = false, debug=true, contactCreated = true, doTransfers = true, transferGainer = false; int cmd=0; const char *thatAccount="secura2-ote2", *thisAccount="secura1-ote"; string op("newInstance"); const string claims("claims"), sunrise("sunrise"), landrush("landrush"); Transaction thisTest; scenario(thisConfig->tkScenario,thisConfig->cfg_path); while(debug) { debug=false; // debugger needs this try { Timer::setTime("20140101.010101"); auto_ptr manager(SessionManagerFactory::newInstance(&props)); auto_ptr sess(SessionFactory::newInstance(&props)); op = "startup"; manager->startup(); op = "run (keep-alive)"; manager->run(); sess->open(); theseLogs->logN(2,"OTE %s [Hello] (%d).",thisAccount,cmd++); sess->writeXML(TEST_SE); sess->read(); theseLogs->logN(1,"OTE Basic Access Setup (%d).",cmd++); const std::string rrj("renjuan"); const std::string rrjPW("Ab9dW@rd"); const std::string rrjEmail("juan@acm.org"); const std::string rrjName("Ren Ren-Juan"); const std::string rrjCity("Niagara Falls"); const std::vector rrjCrib(1,"2926 2nd Strt"); const std::string rrjProv("NY"); const std::string rrjPC("14305"); const std::string rrjGuo("US"); const std::string rrjOrg("American Kybernetik"); const IntPostalInfo rrjPO(rrjName,rrjOrg, rrjCrib,rrjCity,rrjProv,rrjPC,rrjGuo); ContactCreateCommand oteCommand_0(rrj,rrjPW,&rrjPO,rrjEmail); ContactCreateResponse oteResponse_0; theseLogs->logN(1,"(skip) Create Contact(s)."); if (!contactCreated) try { thisTest = Transaction(&oteCommand_0, &oteResponse_0); manager->execute(thisTest); } catch(const std::exception e) { theseLogs->logN(1,"Case %d: %s.",cmd++,e.what()); } catch(...) { theseLogs->logN(1,"Case %d Failed, harness catch.",cmd++); } theseLogs->logN(1,"Continue OTE Transactions."); sleep(2); theseLogs->logN(1,"(%d) Non-LPE check of yoda.guru",cmd++); DomainCheckCommand oteCommand_1(name2); DomainCheckResponse oteResponse_1; try { thisTest = Transaction(&oteCommand_1, &oteResponse_1); manager->execute(thisTest); } catch(...) { theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++); } theseLogs->logN(1,"(%d) Perform Claims type Check of unicycles.bike",cmd++); DomainCheckCommand oteCommand_2("unicycles.bike"); LPChkCmdExtension chkE(&claims); oteCommand_2.appendExtension(chkE); DomainCheckResponse oteResponse_2; LPChkRespExtension chkRspE; oteResponse_2.registerExtension(&chkRspE); try { thisTest = Transaction(&oteCommand_2, &oteResponse_2); manager->execute(thisTest); } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"EPP Exception during OTE B (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str()); } // Used in all of below const std::string pw("Ab9dW@rd"); const std::string RID("renjuan"); std::vector tech(1,std::string("renjuan") ); std::vector admin(1,std::string("renjuan") ); std::vector billing(1,std::string("renjuan") ); std::vector ns(1,std::string("ns1.google.com") );; LPCrtCmdExtension crtE1(&sunrise); if (addDomains) { try { if (1) { theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, name6, thisAccount); DomainCreateCommand oteCommand_3(name6,pw,&RID, &tech, &ns, &admin, &billing); DomainCreateResponse oteResponse_3; thisTest = Transaction(&oteCommand_3, &oteResponse_3); manager->execute(thisTest); } if (1) { theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, name7, thisAccount); DomainCreateCommand oteCommand_3a(name7,pw,&RID, &tech, &ns, &admin, &billing); DomainCreateResponse oteResponse_3a; thisTest = Transaction(&oteCommand_3a, &oteResponse_3a); manager->execute(thisTest); } if (0) { theseLogs->logN(3," (%d) LPE create %s in OTE %s.",cmd++, name5, thisAccount); DomainCreateCommand oteCommand_3b(name5,pw,&RID, &tech, &ns, &admin, &billing); oteCommand_3b.appendExtension(crtE1); DomainCreateResponse oteResponse_3b; thisTest = Transaction(&oteCommand_3b, &oteResponse_3b); manager->execute(thisTest); } if (0) { theseLogs->logN(3," (%d) LPE create %s in OTE %s.",cmd++, name4, thisAccount); /* DomainCreateCommand oteCommand_3c(name4,pw,&RID, &tech, &ns, &admin, &billing); oteCommand_3c.appendExtension(crtE1); DomainCreateResponse oteResponse_3c; thisTest = Transaction(&oteCommand_3c, &oteResponse_3c); manager->execute(thisTest); */ } } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"EPP Exception during OTE B (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str()); } } if (doTransfers) { // const TransferOp *thisTransfer = // transferGainer ? new TransferOp("request") : new TransferOp("approve") ; DomainTransferRequestCommand oteCommand_4a(name1,rrjPW); DomainTransferApproveCommand oteCommand_4b(name1,rrjPW); DomainTransferResponse oteResponse_4; DomainTransferRequestCommand oteCommand_4c(name7,rrjPW); DomainTransferApproveCommand oteCommand_4d(name7,rrjPW); DomainTransferResponse oteResponse_4a; try { theseLogs->logN(4," %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, name1,thatAccount); thisTest = transferGainer ? Transaction(&oteCommand_4a, &oteResponse_4) : Transaction(&oteCommand_4b, &oteResponse_4) ; manager->execute(thisTest); theseLogs->logN(4," %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, name7,thatAccount); thisTest = transferGainer ? Transaction(&oteCommand_4c, &oteResponse_4a) : Transaction(&oteCommand_4d, &oteResponse_4) ; manager->execute(thisTest); } catch(...) { theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++); } } theseLogs->logN(2,"(%d) Sunrise create %s with ICANN SMD test files.",cmd++,name5); DomainCreateCommand oteCommand_5(name5,pw,&RID, &tech, &ns, &admin, &billing); oteCommand_5.appendExtension(crtE1); DomainCreateResponse oteResponse_5; try { thisTest = Transaction(&oteCommand_5, &oteResponse_5); manager->execute(thisTest); } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"EPP Exception during OTE B (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str()); } theseLogs->logN(1,"(%d) Create test-validate.claimsgasix (TCN).",cmd++); DomainCreateCommand oteCommand_6("test-validate.claimsgasix",pw,&RID, &tech, &ns, &admin, &billing); oteCommand_6.appendExtension(crtE1); DomainCreateResponse oteResponse_6; try { thisTest = Transaction(&oteCommand_6, &oteResponse_6); manager->execute(thisTest); } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"EPP Exception during OTE B (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str()); } theseLogs->logN(0,"End OTE Session."); sess->close(); manager->shutdown(); } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"Outer EPP Exception during OTE (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(2,"Outer General Exception in OTE (%s).",op.c_str()); } }// debug while } void ausRegEPPTK::doOTEP() { int hours,hoops; string op("newInstance"); scenario(thisConfig->tkScenario,thisConfig->cfg_path); try { Timer::setTime("20140101.010101"); auto_ptr manager(SessionManagerFactory::newInstance(&props)); auto_ptr sess(SessionFactory::newInstance(&props)); op = "startup"; manager->startup(); op = "run (keep-alive)"; manager->run(); sess->open(); for (hours=0;hours < 24;hours++) { // Spawn the keep alive thread. theseLogs->logN(1,"AC Production Hour %d.",hours); // if thisEPPServer(mdStdDevIdx).vendor == "Donuts" for (hoops=0;hoops<7;hoops++) { sess->writeXML(TEST_SE); sess->read(); sleep(857); } } sess->close(); manager->shutdown(); } catch (EPPException& e) { const char *eMsg = e.getMessage().c_str(); const char *opNow = op.c_str(); theseLogs->logN(2,"EPP Exception in Production (%s): %s .",opNow,eMsg); throw e; } catch (...) { theseLogs->logN(2,"General Exception Production (%s).",op.c_str()); } }