2014-01-29 00:02:24 +00:00
|
|
|
/*
|
|
|
|
* donutsOTEB.h
|
|
|
|
*
|
|
|
|
* Created on: Jan 28, 2014
|
|
|
|
* Author: jdaugherty
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef REGISTRYOTE_H_
|
|
|
|
#define REGISTRYOTB_H_
|
|
|
|
|
2014-01-29 18:10:26 +00:00
|
|
|
typedef auto_ptr<SessionManager> AC_SESSMGR;
|
|
|
|
typedef auto_ptr<Session> AC_SESSION;
|
2014-01-29 02:48:14 +00:00
|
|
|
|
2014-01-29 18:10:26 +00:00
|
|
|
static AC_SESSMGR ac_mgr;
|
|
|
|
static AC_SESSION ac_sess;
|
2014-01-29 02:48:14 +00:00
|
|
|
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
int nCases,thisCase;
|
2014-01-29 02:48:14 +00:00
|
|
|
|
2014-01-29 18:10:26 +00:00
|
|
|
testCases theseCases;
|
|
|
|
testFuncs theseFuncs;
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
|
|
|
|
bool acTkInitialised = false, fatal = false, done = false, transferGainer,
|
|
|
|
bindError;
|
|
|
|
|
2014-02-01 00:06:26 +00:00
|
|
|
const char *thisName = "registrar.ote";
|
|
|
|
string thisRegistry("Unknown"), thatAccount("Unknown"), thisAccount("Unknown"), shitName;
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
int cmd=0,debug=1000;
|
2014-01-29 00:02:24 +00:00
|
|
|
string op("newInstance");
|
|
|
|
|
|
|
|
const string claims("claims"), dpml("custom"), landrush("landrush"), sunrise("sunrise");
|
|
|
|
|
2014-01-29 11:44:52 +00:00
|
|
|
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<std::string>
|
2014-01-30 02:30:49 +00:00
|
|
|
ctcCrib(1,"2926 2nd Strt");
|
2014-01-29 11:44:52 +00:00
|
|
|
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");
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
std::vector<std::string> tech(1,std::string("renjuan") );
|
|
|
|
std::vector<std::string> admin(1,std::string("renjuan") );
|
|
|
|
std::vector<std::string> billing(1,std::string("renjuan") );
|
|
|
|
std::vector<std::string> ns(1,std::string("ns1.google.com") );;
|
|
|
|
|
2014-01-29 11:44:52 +00:00
|
|
|
const IntPostalInfo ctcPO(ctcName,ctcOrg,
|
2014-01-30 15:25:00 +00:00
|
|
|
ctcCrib,ctcCity,ctcProv,ctcPC,ctcGuo);
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
LPCrtCmdExtension crtE1( &claims ), crtE2( &dpml );
|
2014-01-31 23:38:13 +00:00
|
|
|
|
|
|
|
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();
|
2014-02-01 00:06:26 +00:00
|
|
|
thisName = shitName.c_str();
|
2014-01-31 23:38:13 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool checkContOK() {
|
|
|
|
|
|
|
|
if (!parms[thisCase].isMember("cont_id")) {
|
2014-02-01 00:06:26 +00:00
|
|
|
ACPRODINOTE::bindError = true;
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(1,"(%d) no 'cont_id' field",cmd);
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool checkPWDOK(Json::Value thisPW) {
|
|
|
|
|
2014-02-01 00:06:26 +00:00
|
|
|
if (!parms[thisCase].isMember("cont_id")) {
|
|
|
|
ACPRODINOTE::bindError = true;
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(1,"(%d) no 'cont_pw' field",cmd);
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
void check() {
|
|
|
|
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK()) {
|
|
|
|
|
|
|
|
DomainCheckCommand *c = new DomainCheckCommand(thisName);
|
|
|
|
DomainCheckResponse *r = new DomainCheckResponse();
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(2,"(%d) Queue Unextended check of %s",cmd++,thisName);
|
|
|
|
acq.push( new Transaction(c, r) );
|
|
|
|
|
|
|
|
}
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void checkClaims() {
|
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK()) {
|
2014-01-30 02:30:49 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void create() {
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK() && checkContOK())
|
|
|
|
{
|
|
|
|
|
|
|
|
DomainCreateCommand *c = new DomainCreateCommand(shitName,pw,&RID, &tech, &ns, &admin, &billing);
|
2014-01-30 02:30:49 +00:00
|
|
|
DomainCreateResponse *r = new DomainCreateResponse();
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(3,"(%d) Queue normal create of %s ( %s ).",cmd++, thisName, thisAccount.c_str());
|
2014-01-30 15:25:00 +00:00
|
|
|
acq.push(new Transaction(c, r));
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
}
|
|
|
|
|
2014-01-29 00:02:24 +00:00
|
|
|
}
|
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
string noticeID("d85159710000000000000008692"),
|
|
|
|
notAfter("2015-01-01T12:00:00Z"), acceptedDate("2014-01-27T19:00:00Z");
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
void createClaimOverride() {
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK()) {
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing);
|
2014-01-29 00:02:24 +00:00
|
|
|
crtE1.setNoticeID(noticeID, notAfter, acceptedDate);
|
2014-01-30 02:30:49 +00:00
|
|
|
c->appendExtension(crtE1);
|
|
|
|
DomainCreateResponse *r;
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(2,"(%d) Queue create %s w Notice ID test data (TCN).",++cmd,thisName);
|
2014-01-30 15:25:00 +00:00
|
|
|
acq.push(new Transaction(c, r));
|
2014-01-31 23:38:13 +00:00
|
|
|
|
|
|
|
}
|
2014-01-29 00:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void createContact() {
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
ContactCreateCommand *c = new ContactCreateCommand(ctc,ctcPW,&ctcPO,ctcEmail);
|
|
|
|
ContactCreateResponse *r = new ContactCreateResponse();
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(2,"(%d) Queue create contact %s.",++cmd,ctc.c_str());
|
|
|
|
acq.push(new Transaction(c, r));
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
void dpmlCreate() {
|
|
|
|
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK()) {
|
2014-01-30 02:30:49 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-29 11:44:52 +00:00
|
|
|
}
|
2014-01-29 00:02:24 +00:00
|
|
|
|
|
|
|
void sunriseCreate() {
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK()) {
|
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing);
|
|
|
|
c->appendExtension(crtE1);
|
|
|
|
DomainCreateResponse *r = new DomainCreateResponse();
|
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(2,"(%d) Queue Sunrise create %s with ICANN SMD test data.",++cmd,thisName);
|
2014-01-30 15:25:00 +00:00
|
|
|
acq.push(new Transaction(c, r));
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
}
|
|
|
|
|
2014-01-29 00:02:24 +00:00
|
|
|
}
|
|
|
|
|
2014-01-29 11:44:52 +00:00
|
|
|
void transfer() {
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
if (checkNameOK()) {
|
|
|
|
|
|
|
|
Transaction *thisTest;
|
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
DomainTransferRequestCommand *c0 = new DomainTransferRequestCommand(thisName,ctcPW);
|
|
|
|
DomainTransferApproveCommand *c1 = new DomainTransferApproveCommand(thisName,ctcPW);
|
|
|
|
DomainTransferResponse *r = new DomainTransferResponse();
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
thisTest = transferGainer ? new Transaction(c0, r) : new Transaction(c1, r) ;
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
theseLogs->logN(4,"(%d) Queue %s %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++,
|
|
|
|
thisName,thatAccount.c_str());
|
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
acq.push(thisTest);
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-31 23:38:13 +00:00
|
|
|
}
|
|
|
|
|
2014-01-29 00:02:24 +00:00
|
|
|
} // transfer
|
|
|
|
|
2014-01-29 02:48:14 +00:00
|
|
|
int setFuncs() {
|
2014-01-29 00:02:24 +00:00
|
|
|
|
2014-01-29 02:48:14 +00:00
|
|
|
theseFuncs["case00"] = createContact;
|
|
|
|
theseFuncs["case01"] = check;
|
|
|
|
theseFuncs["case02"] = checkClaims;
|
|
|
|
theseFuncs["case03"] = create;
|
2014-01-29 11:44:52 +00:00
|
|
|
theseFuncs["case04"] = sunriseCreate;
|
2014-01-30 02:30:49 +00:00
|
|
|
theseFuncs["case05"] = createClaimOverride;
|
2014-01-29 11:44:52 +00:00
|
|
|
theseFuncs["case06"] = transfer;
|
|
|
|
|
2014-01-30 02:30:49 +00:00
|
|
|
theseLogs->logN(0,"7 test case backends available for scripting");
|
2014-01-29 23:57:01 +00:00
|
|
|
|
2014-01-29 11:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-29 00:02:24 +00:00
|
|
|
#endif /* REGISTRY_X */
|