/* * donutsOTEB.h * * Created on: Jan 28, 2014 * Author: jdaugherty */ #ifndef REGISTRYOTE_H_ #define REGISTRYOTB_H_ typedef auto_ptr AC_SESSMGR; typedef auto_ptr AC_SESSION; static AC_SESSMGR ac_mgr; static AC_SESSION ac_sess; int nCases,thisCase; testCases theseCases; testFuncs theseFuncs; bool acTkInitialised = false, fatal = false, done = false, transferGainer, bindError; const char *thisName = "registrar.ote"; string thisRegistry("Unknown"), thatAccount("Unknown"), thisAccount("Unknown"), shitName; int cmd=0,debug=1000; string op("newInstance"); const string claims("claims"), dpml("custom"), landrush("landrush"), sunrise("sunrise"); std::string ctc("renjuan"); std::string ctcPW("Ab9dW@rd"); std::string ctcEmail("juan@acm.org"); std::string ctcName("Ren Ren-Juan"); std::string ctcCity("Niagara Falls"); std::vector ctcCrib(1,"2926 2nd Strt"); std::string ctcProv("NY"); std::string ctcPC("14305"); std::string ctcGuo("US"); std::string ctcOrg("American Kybernetik"); std::string pw("Ab9dW@rd"); 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") );; const IntPostalInfo ctcPO(ctcName,ctcOrg, ctcCrib,ctcCity,ctcProv,ctcPC,ctcGuo); LPCrtCmdExtension crtE1( &claims ), crtE2( &dpml ); inline bool checkNameOK() { if (!parms[thisCase].isMember("name")) { theseLogs->logN(1,"(%d) no 'name' field",cmd); ACPRODINOTE::bindError = true; return false; } shitName = parms[thisCase]["name"].asString(); thisName = shitName.c_str(); return true; } inline bool checkContOK() { if (!parms[thisCase].isMember("cont_id")) { ACPRODINOTE::bindError = true; theseLogs->logN(1,"(%d) no 'cont_id' field",cmd); return false; } return true; } inline bool checkPWDOK(Json::Value thisPW) { if (!parms[thisCase].isMember("cont_id")) { ACPRODINOTE::bindError = true; theseLogs->logN(1,"(%d) no 'cont_pw' field",cmd); return false; } return true; } void check() { if (checkNameOK()) { DomainCheckCommand *c = new DomainCheckCommand(thisName); DomainCheckResponse *r = new DomainCheckResponse(); theseLogs->logN(2,"(%d) Queue Unextended check of %s",cmd++,thisName); acq.push( new Transaction(c, r) ); } } void checkClaims() { if (checkNameOK()) { DomainCheckCommand *c = new DomainCheckCommand(thisName); LPChkCmdExtension chkE(&claims); c->appendExtension(chkE); DomainCheckResponse *r = new DomainCheckResponse(); LPChkRespExtension chkRspE; r->registerExtension(&chkRspE); theseLogs->logN(2,"(%d) Queue Claims type Check of %s",cmd++,thisName); acq.push(new Transaction(c, r)); } } void create() { if (checkNameOK() && checkContOK()) { DomainCreateCommand *c = new DomainCreateCommand(shitName,pw,&RID, &tech, &ns, &admin, &billing); DomainCreateResponse *r = new DomainCreateResponse(); theseLogs->logN(3,"(%d) Queue normal create of %s ( %s ).",cmd++, thisName, thisAccount.c_str()); acq.push(new Transaction(c, r)); } } string noticeID("d85159710000000000000008692"), notAfter("2015-01-01T12:00:00Z"), acceptedDate("2014-01-27T19:00:00Z"); void createClaimOverride() { if (checkNameOK()) { DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing); crtE1.setNoticeID(noticeID, notAfter, acceptedDate); c->appendExtension(crtE1); DomainCreateResponse *r; theseLogs->logN(2,"(%d) Queue create %s w Notice ID test data (TCN).",++cmd,thisName); acq.push(new Transaction(c, r)); } } void createContact() { ContactCreateCommand *c = new ContactCreateCommand(ctc,ctcPW,&ctcPO,ctcEmail); ContactCreateResponse *r = new ContactCreateResponse(); theseLogs->logN(2,"(%d) Queue create contact %s.",++cmd,ctc.c_str()); acq.push(new Transaction(c, r)); } void dpmlCreate() { if (checkNameOK()) { DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing); crtE2.setSMD(); c->appendExtension(crtE2); DomainCreateResponse *r = new DomainCreateResponse(); theseLogs->logN(2,"(%d) Queue DPML block create %s w boitedetest.smd data.",++cmd,thisName); acq.push(new Transaction(c, r)); } } void sunriseCreate() { if (checkNameOK()) { DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing); c->appendExtension(crtE1); DomainCreateResponse *r = new DomainCreateResponse(); theseLogs->logN(2,"(%d) Queue Sunrise create %s with ICANN SMD test data.",++cmd,thisName); acq.push(new Transaction(c, r)); } } void transfer() { if (checkNameOK()) { Transaction *thisTest; DomainTransferRequestCommand *c0 = new DomainTransferRequestCommand(thisName,ctcPW); DomainTransferApproveCommand *c1 = new DomainTransferApproveCommand(thisName,ctcPW); DomainTransferResponse *r = new DomainTransferResponse(); thisTest = transferGainer ? new Transaction(c0, r) : new Transaction(c1, r) ; theseLogs->logN(4,"(%d) Queue %s %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, thisName,thatAccount.c_str()); acq.push(thisTest); } } // transfer int setFuncs() { theseFuncs["case00"] = createContact; theseFuncs["case01"] = check; theseFuncs["case02"] = checkClaims; theseFuncs["case03"] = create; theseFuncs["case04"] = sunriseCreate; theseFuncs["case05"] = createClaimOverride; theseFuncs["case06"] = transfer; theseLogs->logN(0,"7 test case backends available for scripting"); } #endif /* REGISTRY_X */