DRDE/AusRegCliever/include/AC_OTE.h

285 lines
9.0 KiB
C
Raw Normal View History

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
namespace AC_OTE {
2014-01-29 02:48:14 +00:00
static int nCases;
2014-01-29 18:10:26 +00:00
testCases theseCases;
testFuncs theseFuncs;
2014-01-29 00:02:24 +00:00
2014-01-29 11:44:52 +00:00
bool acTkInitialised = false, fatal = false, done = false, transferGainer;
2014-01-29 00:02:24 +00:00
const char *thisRegistry="Donuts", *thatAccount="secura2-ote2", *thisAccount="secura1-ote";
char *thisName;
int cmd=0;
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>
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");
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,
ctcCrib,ctcCity,ctcProv,ctcPC,ctcGuo);
2014-01-29 00:02:24 +00:00
LPCrtCmdExtension crtE1( &claims ), crtE2( &dpml );
Transaction thisTest;
void check() {
theseLogs->logN(2,"(%d) Unextended check of %s",cmd++,thisName);
DomainCheckCommand oteCommand_1(thisName);
DomainCheckResponse oteResponse_1;
try {
thisTest = Transaction(&oteCommand_1, &oteResponse_1);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, fatal to suite.",cmd++);
fatal = true;
}
}
void checkClaims() {
theseLogs->logN(2,"(%d) Perform Claims type Check of %s",cmd++,thisName);
DomainCheckCommand oteCommand_2(thisName);
LPChkCmdExtension chkE(&claims);
oteCommand_2.appendExtension(chkE);
DomainCheckResponse oteResponse_2;
LPChkRespExtension chkRspE;
oteResponse_2.registerExtension(&chkRspE);
try {
thisTest = Transaction(&oteCommand_2, &oteResponse_2);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
theseLogs->logN(3,"(%d) Claims %s exist for %s.",
cmd,(chkRspE.doClaimsExist() ? "do" : " do not "),thisName);
if (chkRspE.doClaimsExist())
theseLogs->logN(3,"(%d) claim: %s .",cmd,chkRspE.getClaimsKey());
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
theseLogs->logN(2,"EPP Exception during OTE (%s): %s .",opNow,eMsg);
throw e;
}
catch (...)
{
theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str());
}
}
void create() {
theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, thisName, thisAccount);
DomainCreateCommand
oteCommand_3(thisName,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3;
thisTest = Transaction(&oteCommand_3, &oteResponse_3);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
}
void createClaimOverride() {
theseLogs->logN(2,"(%d) Create %s w Notice ID test data (TCN).",++cmd,thisName);
string noticeID("d85159710000000000000008692"),
notAfter("2015-01-01T12:00:00Z"), acceptedDate("2014-01-27T19:00:00Z");
DomainCreateCommand oteCommand_6(thisName,pw,&RID, &tech, &ns, &admin, &billing);
crtE1.setNoticeID(noticeID, notAfter, acceptedDate);
oteCommand_6.appendExtension(crtE1);
DomainCreateResponse oteResponse_6;
try {
thisTest = Transaction(&oteCommand_6, &oteResponse_6);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
}
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());
}
}
void createContact() {
2014-01-29 11:44:52 +00:00
ContactCreateCommand oteCommand_0(ctc,ctcPW,&ctcPO,ctcEmail);
2014-01-29 00:02:24 +00:00
ContactCreateResponse oteResponse_0;
theseLogs->logN(1,"(skip) Create Contact(s).");
try {
thisTest = Transaction(&oteCommand_0, &oteResponse_0);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
}
catch(const std::exception e)
{
theseLogs->logN(1,"Case %d: %s.",cmd++,e.what());
}
catch(...)
{
theseLogs->logN(1,"Case %d Failed, harness catch.",cmd++);
}
}
void dpmlCreate() { std::string dpmlName("face.dpml.zone");
2014-01-29 11:44:52 +00:00
theseLogs->logN(2,"(%d) Create %s w ICANN SMD file.",++cmd,dpmlName.c_str());
2014-01-29 00:02:24 +00:00
2014-01-29 11:44:52 +00:00
DomainCreateCommand oteCommand_7(dpmlName,pw,&RID, &tech, &ns, &admin, &billing);
crtE2.setSMD();
oteCommand_7.appendExtension(crtE2);
DomainCreateResponse oteResponse_7;
2014-01-29 00:02:24 +00:00
2014-01-29 11:44:52 +00:00
try {
thisTest = Transaction(&oteCommand_7, &oteResponse_7);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 11:44:52 +00:00
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
theseLogs->logN(2,"EPP Exception during OTEX (%s): %s .",opNow,eMsg);
throw e;
}
catch (...)
2014-01-29 00:02:24 +00:00
{
2014-01-29 11:44:52 +00:00
theseLogs->logN(1,"General ExceptionXE B (%s).",op.c_str());
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() {
theseLogs->logN(2,"(%d) Sunrise create %s with ICANN SMD test data.",++cmd,thisName);
DomainCreateCommand oteCommand_5(thisName,pw,&RID, &tech, &ns, &admin, &billing);
oteCommand_5.appendExtension(crtE1);
DomainCreateResponse oteResponse_5;
try {
thisTest = Transaction(&oteCommand_5, &oteResponse_5);
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
}
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());
}
}
2014-01-29 11:44:52 +00:00
void transfer() {
2014-01-29 00:02:24 +00:00
DomainTransferRequestCommand
2014-01-29 11:44:52 +00:00
oteCommand_4a(thisName,ctcPW);
2014-01-29 00:02:24 +00:00
DomainTransferApproveCommand
2014-01-29 11:44:52 +00:00
oteCommand_4b(thisName,ctcPW);
2014-01-29 00:02:24 +00:00
DomainTransferResponse oteResponse_4;
try {
theseLogs->logN(4," %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, thisName,thatAccount);
thisTest = transferGainer ? Transaction(&oteCommand_4a, &oteResponse_4) :
Transaction(&oteCommand_4b, &oteResponse_4) ;
2014-01-29 18:10:26 +00:00
ac_mgr->execute(thisTest);
2014-01-29 00:02:24 +00:00
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, non fatal.",cmd++);
}
} // 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;
theseFuncs["case05"] = createClaimOverride;
2014-01-29 11:44:52 +00:00
theseFuncs["case04"] = sunriseCreate;
theseFuncs["case06"] = transfer;
}
bool setupTestCase(Json::Value where) { // Set recognized variables, silently ignore others
int i;
2014-01-29 00:02:24 +00:00
2014-01-29 11:44:52 +00:00
for (i=0;i<where.size();i++) {
2014-01-29 00:02:24 +00:00
2014-01-29 11:44:52 +00:00
thisName = (char *)where[i].get("name","missing").asString().c_str();
ctc = where[i].get("cont_id","renjuan").asString();
ctcPW = where[i].get("cont_pw","Ab9dW@rd").asString(); /*
ctcEmail = (char *)where[i].get("cont_email","juan@acm.org").asString();
ctcName = where[i].get("cont_name","Ren Ren-Juan").asString().c_str();
ctcCity = "Niagara Falls"
const std::vector<std::string>
ctcCrib = (1,"2926 2nd Street"
ctcProv = "NY"
ctcPC = "14305"
ctcGuo = "US"
ctcOrg = "American Kybernetik"
RID = "renjuan" */
}
2014-01-29 02:48:14 +00:00
}
2014-01-29 11:44:52 +00:00
2014-01-29 18:10:26 +00:00
} // AC_OTE namespace
2014-01-29 00:02:24 +00:00
#endif /* REGISTRY_X */