This commit is contained in:
Ren RenJuan 2014-01-30 02:30:49 +00:00
parent 7c140f266b
commit 709fedf6bf
4 changed files with 70 additions and 164 deletions

View File

@ -26,7 +26,7 @@ namespace AC_OTE {
const char *thisRegistry="Donuts", *thatAccount="secura2-ote2", *thisAccount="secura1-ote";
char *thisName;
int cmd=0;
int cmd=0,debug=1000;
string op("newInstance");
const string claims("claims"), dpml("custom"), landrush("landrush"), sunrise("sunrise");
@ -37,7 +37,7 @@ namespace AC_OTE {
std::string ctcName("Ren Ren-Juan");
std::string ctcCity("Niagara Falls");
std::vector<std::string>
ctcCrib(1,"2926 2nd Strt");
ctcCrib(1,"2926 2nd Strt");
std::string ctcProv("NY");
std::string ctcPC("14305");
std::string ctcGuo("US");
@ -55,118 +55,71 @@ namespace AC_OTE {
ctcCrib,ctcCity,ctcProv,ctcPC,ctcGuo);
LPCrtCmdExtension crtE1( &claims ), crtE2( &dpml );
Transaction thisTest;
Transaction *thisTest;
void check() {
theseLogs->logN(2,"(%d) Unextended check of %s",cmd++,thisName);
theseLogs->logN(2,"Queue (%d) Unextended check of %s",cmd++,thisName);
DomainCheckCommand oteCommand_1(thisName);
DomainCheckResponse oteResponse_1;
DomainCheckCommand *c = new DomainCheckCommand(thisName);
DomainCheckResponse *r = new DomainCheckResponse();
try {
thisTest = Transaction(&oteCommand_1, &oteResponse_1);
ac_mgr->execute(thisTest);
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, fatal to suite.",cmd++);
fatal = true;
}
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
void checkClaims() {
theseLogs->logN(2,"(%d) Perform Claims type Check of %s",cmd++,thisName);
theseLogs->logN(2,"(%d) Queue 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);
DomainCheckCommand *c = new DomainCheckCommand(thisName);
LPChkCmdExtension chkE(&claims);
c->appendExtension(chkE);
DomainCheckResponse *r = new DomainCheckResponse();
LPChkRespExtension chkRspE;
r->registerExtension(&chkRspE);
try {
thisTest = Transaction(&oteCommand_2, &oteResponse_2);
ac_mgr->execute(thisTest);
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());
}
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
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);
ac_mgr->execute(thisTest);
theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, thisName, thisAccount);
DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse *r = new DomainCreateResponse();
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
string noticeID("d85159710000000000000008692"),
notAfter("2015-01-01T12:00:00Z"), acceptedDate("2014-01-27T19:00:00Z");
void createClaimOverride() {
theseLogs->logN(2,"(%d) Create %s w Notice ID test data (TCN).",++cmd,thisName);
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);
DomainCreateCommand *c = new DomainCreateCommand(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);
ac_mgr->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());
}
c->appendExtension(crtE1);
DomainCreateResponse *r;
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
void createContact() {
ContactCreateCommand oteCommand_0(ctc,ctcPW,&ctcPO,ctcEmail);
ContactCreateResponse oteResponse_0;
theseLogs->logN(0,"Create a Contact.");
ContactCreateCommand *c = new ContactCreateCommand(ctc,ctcPW,&ctcPO,ctcEmail);
ContactCreateResponse *r = new ContactCreateResponse();
theseLogs->logN(1,"(skip) Create Contact(s).");
try {
thisTest = Transaction(&oteCommand_0, &oteResponse_0);
ac_mgr->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++);
}
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
@ -174,25 +127,13 @@ namespace AC_OTE {
theseLogs->logN(2,"(%d) Create %s w ICANN SMD file.",++cmd,dpmlName.c_str());
DomainCreateCommand oteCommand_7(dpmlName,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateCommand *c = new DomainCreateCommand(dpmlName,pw,&RID, &tech, &ns, &admin, &billing);
crtE2.setSMD();
oteCommand_7.appendExtension(crtE2);
DomainCreateResponse oteResponse_7;
c->appendExtension(crtE2);
DomainCreateResponse *r = new DomainCreateResponse();
try {
thisTest = Transaction(&oteCommand_7, &oteResponse_7);
ac_mgr->execute(thisTest);
}
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 (...)
{
theseLogs->logN(1,"General ExceptionXE B (%s).",op.c_str());
}
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
@ -200,48 +141,26 @@ namespace AC_OTE {
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;
DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing);
c->appendExtension(crtE1);
DomainCreateResponse *r = new DomainCreateResponse();
try {
thisTest = Transaction(&oteCommand_5, &oteResponse_5);
ac_mgr->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());
}
thisTest = new Transaction(c, r);
acq.push(thisTest);
}
void transfer() {
DomainTransferRequestCommand
oteCommand_4a(thisName,ctcPW);
DomainTransferApproveCommand
oteCommand_4b(thisName,ctcPW);
DomainTransferResponse oteResponse_4;
try {
DomainTransferRequestCommand *c0 = new DomainTransferRequestCommand(thisName,ctcPW);
DomainTransferApproveCommand *c1 = new DomainTransferApproveCommand(thisName,ctcPW);
DomainTransferResponse *r = new DomainTransferResponse();
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) ;
ac_mgr->execute(thisTest);
thisTest = transferGainer ? new Transaction(c0, r) : new Transaction(c1, r) ;
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, non fatal.",cmd++);
}
acq.push(thisTest);
} // transfer
@ -251,36 +170,14 @@ namespace AC_OTE {
theseFuncs["case01"] = check;
theseFuncs["case02"] = checkClaims;
theseFuncs["case03"] = create;
theseFuncs["case05"] = createClaimOverride;
theseFuncs["case04"] = sunriseCreate;
theseFuncs["case05"] = createClaimOverride;
theseFuncs["case06"] = transfer;
theseLogs->logN(0,"7 test cases bound");
theseLogs->logN(0,"7 test case backends available for scripting");
}
bool setupTestCase(Json::Value where) { // Set recognized variables, silently ignore others
int i;
for (i=0;i<where.size();i++) {
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" */
}
}
} // AC_OTE namespace
#endif /* REGISTRY_X */

View File

@ -293,7 +293,6 @@ void ausRegEPPTK::doOTEB()
{
theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str());
}
}
theseLogs->logN(0,"End OTE Session.");

View File

@ -237,6 +237,11 @@ void ausRegEPPTK::doPROD()
if (!acq.empty()) { idleSeconds = 0;
Transaction *tx = acq.top();
manager->execute(*tx);
acq.pop();
delete tx;
}
if (idleSeconds >= (857 - PRODINOTESLEEP)) { idleSeconds = 0;

View File

@ -63,7 +63,7 @@ bool mdJSON::run()
Json::Value::Members itemNames = suite.getMemberNames();
for ( i = 0; i < itemNames.size(); ++i ) { const char *thisItem;
try {
thisItem = itemNames[i].c_str();
if (debug > 100)
theseLogs->logN(1,"item %s.",thisItem);
@ -78,13 +78,18 @@ bool mdJSON::run()
if (!suite[i].isObject()) {
theseLogs->logN(1,"'%s' isn't an object, can't use.",thisItem);
continue;
}
AC_OTE::theseCases[nCases].parms = &suite[i];
} /*
AC_OTE::theseCases[nCases].parms = NULL;
AC_OTE::theseCases[nCases].fBody = AC_OTE::theseFuncs[thisItem];
AC_OTE::theseCases[nCases++].caseName = thisItem;
AC_OTE::theseCases[nCases++].caseName = thisItem; */
}
catch (...)
{
theseLogs->logN(1,"Test case binding exception: %s ",thisItem );
}
}
theseLogs->logN(1,"%d cases bound.",nCases);
theseLogs->logN(1,"%d cases bound, beginning execution.",nCases);
for (i=0;i<AC_OTE::theseCases.size();i++) {
try{
@ -95,7 +100,7 @@ bool mdJSON::run()
}
catch (...)
{
theseLogs->logN(1,"Inner JSON Exception in %s ",AC_OTE::theseCases[i].caseName );
theseLogs->logN(1,"Test case execution exception in %s ",AC_OTE::theseCases[i].caseName );
}
}
theseLogs->logN(0,"Suite 'testSuite00' end execution.");