This commit is contained in:
Ren RenJuan 2014-01-30 23:27:18 +00:00
parent 9cd15aedc4
commit 3b7799220e
11 changed files with 68 additions and 38 deletions

View File

@ -14,7 +14,6 @@ typedef auto_ptr<Session> AC_SESSION;
static AC_SESSMGR ac_mgr;
static AC_SESSION ac_sess;
namespace AC_OTE {
static int nCases;
@ -58,18 +57,17 @@ namespace AC_OTE {
void check() {
theseLogs->logN(2,"Queue (%d) Unextended check of %s",cmd++,thisName);
DomainCheckCommand *c = new DomainCheckCommand(thisName);
DomainCheckResponse *r = new DomainCheckResponse();
theseLogs->logN(2,"Queue (%d) Unextended check of %s",cmd++,thisName);
acq.push( new Transaction(c, r) );
}
void checkClaims() {
theseLogs->logN(2,"(%d) Queue Claims type Check of %s",cmd++,thisName);
DomainCheckCommand *c = new DomainCheckCommand(thisName);
LPChkCmdExtension chkE(&claims);
@ -78,13 +76,14 @@ namespace AC_OTE {
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() {
theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, thisName, thisAccount);
theseLogs->logN(3,"(%d) Queue normal create of %s ( %s ).",cmd++, thisName, thisAccount);
DomainCreateCommand *c = new DomainCreateCommand(thisName,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse *r = new DomainCreateResponse();
@ -97,47 +96,46 @@ namespace AC_OTE {
void createClaimOverride() {
theseLogs->logN(2,"(%d) Create %s w Notice ID test data (TCN).",++cmd,thisName);
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() {
theseLogs->logN(0,"Create a Contact.");
theseLogs->logN(2,"(%d)Queue create contact %s.",++cmd,ctc.c_str());
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() { std::string dpmlName("face.dpml.zone");
theseLogs->logN(2,"(%d) Create %s w ICANN SMD file.",++cmd,dpmlName.c_str());
DomainCreateCommand *c = new DomainCreateCommand(dpmlName,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,dpmlName.c_str());
acq.push(new Transaction(c, r));
}
void sunriseCreate() {
theseLogs->logN(2,"(%d) Sunrise create %s with ICANN SMD test data.",++cmd,thisName);
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));
}
@ -148,10 +146,9 @@ namespace AC_OTE {
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 ? new Transaction(c0, r) : new Transaction(c1, r) ;
theseLogs->logN(4,"Queue %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, thisName,thatAccount);
acq.push(thisTest);
} // transfer
@ -171,5 +168,4 @@ namespace AC_OTE {
}
} // AC_OTE namespace
#endif /* REGISTRY_X */

View File

@ -18,6 +18,10 @@
#include <vector>
#endif
#define REGISTRY_HANDSHAKE 540
#define MIN_TRANSQ_POLICY 256
namespace ACPRODINOTE {
class ausRegEPPTK {
friend class masterDaemon;
@ -42,3 +46,4 @@ class ausRegEPPTK {
void registryXOTE();
};
}

View File

@ -44,7 +44,7 @@ public:
sentCommands;
#if (ARTKENABLED > 0)
ausRegEPPTK *artk;
ACPRODINOTE::ausRegEPPTK *artk;
#endif
masterDaemonConfig *cfg;
mdDGChannel *bg,*fg;

View File

@ -16,9 +16,13 @@
const void *parms; // JSON Value
} testCase;
namespace ACPRODINOTE {
typedef std::map<int,testCase> testCases;
typedef std::map<string,caseBody> testFuncs;
}
#ifdef MD_JSON
static Json::Value root;
#else

View File

@ -213,3 +213,4 @@ void usage() {
exit(1);
}

View File

@ -135,7 +135,7 @@ int masterDaemon::initAusRegTK(void) {
theseLogs->logN(2,"Attaching AusRegistry EPP Toolkit %d at tkScenario %d.",
ARTKENABLED, thisConfig->tkScenario);
artk = new ausRegEPPTK();
artk = new ACPRODINOTE::ausRegEPPTK();
if (!artk->doNothing(cfg)) {
theseLogs->logN(1,"Toolkit init failed.");
rc = NOT_OK;
@ -402,5 +402,6 @@ void runAPILayer() {
}
theseLogs->logNdebug(1,0,"mainbus background thread exited.");
}

View File

@ -1,5 +1,6 @@
#include "cliever-md.h"
const char *mdStdErrs[] = { "No error detected.", "Required state/element missing.", "Already exists.",
"Conflict detected.", "Not ready.", "Syntax error." };

View File

@ -27,6 +27,8 @@
#include <json/json.h>
#include "mdJSON.hpp"
namespace ACPRODINOTE {
typedef boost::heap::priority_queue<Transaction *> ACWQ;
ACWQ acq;
@ -98,7 +100,7 @@ void ausRegEPPTK::doOTEA()
for (hoops=0;hoops<7;hoops++) {
sess->writeXML(TEST_SE);
sess->read();
sleep(857);
sleep(REGISTRY_HANDSHAKE);
}
}
@ -132,7 +134,7 @@ void ausRegEPPTK::registryXOTE() { // PROD in OTE
theseLogs->logN(0,"Begin RegistryXOTE Session.");
AC_OTE::setFuncs();
ACPRODINOTE::setFuncs();
fd = inotify_init();
@ -221,11 +223,18 @@ void ausRegEPPTK::registryXOTE() { // PROD in OTE
}
void ausRegEPPTK::doPROD()
{
int debug=1000000,hours=0,hoops,minutes=0,seconds=0,idleSeconds=0,lastSeconds=0,lastMinutes;
int debug=1000000,hours=0,hoops,minutes=0,seconds=0,idleSeconds=0,lastPolicyHandshake=0,
lastSeconds=0,lastMinutes,iqSize=acq.max_size();
string op("newInstance");
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
if (iqSize < MIN_TRANSQ_POLICY) {
acq.reserve(MIN_TRANSQ_POLICY - iqSize);
iqSize=acq.max_size();
theseLogs->logN(1,"Workq size: %d",iqSize);
}
try {
Timer::setTime("20140101.010101");
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
@ -235,13 +244,12 @@ void ausRegEPPTK::doPROD()
op = "run (keep-alive)";
manager->run();
sess->open();
ac_mgr = manager;
ac_sess = sess;
// ac_mgr = manager;
// ac_sess = sess;
while ((1440 - minutes) > EODMARGIN) {
if (!acq.empty()) { idleSeconds = 0;
if (!acq.empty()) {
Transaction *tx = acq.top();
if (debug > 999)
@ -251,12 +259,17 @@ void ausRegEPPTK::doPROD()
if (debug > 999)
theseLogs->logN(2,"Tx completed @ minute %d second %d.",minutes,seconds);
idleSeconds = 0;
acq.pop();
delete tx;
}
if (idleSeconds >= (857 - PRODINOTESLEEP)) { idleSeconds = 0;
if (!lastPolicyHandshake || (seconds - lastPolicyHandshake >= (REGISTRY_HANDSHAKE - 5)))
{idleSeconds = 0;
if (debug > 99)
theseLogs->logN(3,"AC-Registry Policy Handshake %d:%d:%d.",hours-1,minutes,seconds);
lastPolicyHandshake = seconds;
sess->writeXML(TEST_SE);
sess->read();
}
@ -273,7 +286,7 @@ void ausRegEPPTK::doPROD()
lastMinutes = minutes;
}
if (debug > 9999 && !(seconds % 10))
if (debug > 9999 && !(seconds % 30))
theseLogs->logN(3,"AC Production %d:%d:%d.",hours-1,minutes,seconds);
}
@ -293,3 +306,4 @@ void ausRegEPPTK::doPROD()
}
}
}

View File

@ -332,3 +332,4 @@ void mdPeer::registerCmd(const char *cmdName,const mdIncoming &thisOne) {
result->send();
}

View File

@ -11,11 +11,12 @@
#include <stdio.h>
#include "mdJSON.hpp"
namespace AC_OTE {
extern testCases theseCases;
extern testFuncs theseFuncs;
}
namespace ACPRODINOTE {
extern testCases theseCases;
extern testFuncs theseFuncs;
}
using namespace std;
static std::string
@ -74,7 +75,7 @@ bool mdJSON::run()
if (strlen(thisItem) != 6) continue;
if (debug > 100000)
theseLogs->logN(1,"case %s.",thisItem);
if (!AC_OTE::theseFuncs[thisItem]) {
if (!ACPRODINOTE::theseFuncs[thisItem]) {
theseLogs->logN(1,"No logic to bind to '%s', need it.",thisItem);
return false;
}
@ -82,9 +83,9 @@ bool mdJSON::run()
// theseLogs->logN(1,"'%s' isn't an object, can't use.",thisItem);
// continue;
//}
AC_OTE::theseCases[nCases].parms = NULL;
AC_OTE::theseCases[nCases].fBody = AC_OTE::theseFuncs[thisItem];
AC_OTE::theseCases[nCases++].caseName = thisItem;
ACPRODINOTE::theseCases[nCases].parms = NULL;
ACPRODINOTE::theseCases[nCases].fBody = ACPRODINOTE::theseFuncs[thisItem];
ACPRODINOTE::theseCases[nCases++].caseName = thisItem;
}
catch (...)
{
@ -94,15 +95,19 @@ bool mdJSON::run()
theseLogs->logN(1,"%d cases bound, beginning execution.",nCases);
for (i=0;i<AC_OTE::theseCases.size();i++) {
for (i=0;i<ACPRODINOTE::theseCases.size();i++) {
try{
theseLogs->logN(2,"%d Begin setup of %s ",i+1,AC_OTE::theseCases[i].caseName );
AC_OTE::theseCases[i].fBody();
theseLogs->logN(2,"%d End setup of %s ",i+1,AC_OTE::theseCases[i].caseName );
theseLogs->logN(2,"%d Begin setup of %s ",i+1,ACPRODINOTE::theseCases[i].caseName );
ACPRODINOTE::theseCases[i].fBody();
theseLogs->logN(2,"%d End setup of %s ",i+1,ACPRODINOTE::theseCases[i].caseName );
}
catch (exception e)
{
theseLogs->logN(2,"Case %s fault: %s ",ACPRODINOTE::theseCases[i].caseName, e.what());
}
catch (...)
{
theseLogs->logN(1,"Test case execution exception in %s ",AC_OTE::theseCases[i].caseName );
theseLogs->logN(1,"Unknown test case fault in %s ",ACPRODINOTE::theseCases[i].caseName );
}
}
theseLogs->logN(0,"Suite 'testSuite00' end execution.");

View File

@ -2,6 +2,7 @@
#include "cliever-md.h"
#include "masterDaemon.h"
class mdResponse;
using namespace std;
@ -150,3 +151,4 @@ void mdState::registerData(const char *dataName,const mdIncoming &thisOne) {
result->send();
}