This commit is contained in:
Ren RenJuan 2014-01-29 18:10:26 +00:00
parent 75f68ade2d
commit c8ada0ffd4
10 changed files with 329 additions and 215 deletions

View File

@ -23,7 +23,7 @@
struct { struct {
bool hasXML:1; bool hasXML:1;
bool reserved:7; bool reserved:7;
void bre[MAX_FSM]; void *bre[MAX_FSM];
char *fsm[MAX_FSM]; // by which known at MD char *fsm[MAX_FSM]; // by which known at MD
} }
eppState; eppState;

View File

@ -76,8 +76,8 @@ CLFLAGS= -Wall -Wundef -Wpointer-arith -Wshadow \
-Wmissing-prototypes -Wnested-externs \ -Wmissing-prototypes -Wnested-externs \
-Wstrict-prototypes -Waggregate-return -Wno-implicit -Wstrict-prototypes -Waggregate-return -Wno-implicit
ACOBJS= build/cliever.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \ ACOBJS= build/mdAusReg.o build/cliever.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \
build/mdHost.o build/mdState.o build/mdAusReg.o build/mdJSON.o build/mdHost.o build/mdState.o build/mdJSON.o
MDOBJS= build/md.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \ MDOBJS= build/md.o build/mdLogger.o build/masterDaemonConfig.o build/masterDaemon.o \
build/mdHost.o build/mdState.o build/mdHost.o build/mdState.o
@ -121,10 +121,10 @@ build/mdState.o: server/mdState.cpp include/mdState.h
build/masterDaemon.o: server/masterDaemon.cpp include/masterDaemon.h build/masterDaemon.o: server/masterDaemon.cpp include/masterDaemon.h
$(CC) $(CFLAGS) server/masterDaemon.cpp -c -o build/masterDaemon.o $(SINCL) $(ARTKINCL) $(CC) $(CFLAGS) server/masterDaemon.cpp -c -o build/masterDaemon.o $(SINCL) $(ARTKINCL)
build/mdJSON.o: server/mdJSON.cpp include/mdJSON.hpp include/RegistryXOTE.h build/mdJSON.o: server/mdJSON.cpp include/mdJSON.hpp
$(CC) $(CFLAGS) server/mdJSON.cpp -c -o build/mdJSON.o $(SINCL) $(ARTKINCL) $(CC) $(CFLAGS) server/mdJSON.cpp -c -o build/mdJSON.o $(SINCL) $(ARTKINCL)
build/mdAusReg.o: server/mdAusReg.cpp include/ausRegTK.h build/mdAusReg.o: server/mdAusReg.cpp include/ausRegTK.h include/AC_OTE.h
$(CC) $(CFLAGS) server/mdAusReg.cpp -c -o build/mdAusReg.o $(SINCL) $(ARTKINCL) $(ARTKLIB) -l libACTK1_0.so $(CC) $(CFLAGS) server/mdAusReg.cpp -c -o build/mdAusReg.o $(SINCL) $(ARTKINCL) $(ARTKLIB) -l libACTK1_0.so
build/ausreg-md: $(MDOBJS) build/ausreg-md: $(MDOBJS)

View File

@ -8,31 +8,18 @@
#ifndef REGISTRYOTE_H_ #ifndef REGISTRYOTE_H_
#define REGISTRYOTB_H_ #define REGISTRYOTB_H_
typedef void (*caseBody)(void); typedef auto_ptr<SessionManager> AC_SESSMGR;
typedef auto_ptr<Session> AC_SESSION;
typedef struct { static AC_SESSMGR ac_mgr;
const char *caseName; static AC_SESSION ac_sess;
caseBody fBody;
const Json::Value *parms;
} testCase;
typedef std::map<int,testCase> testCases;
typedef std::map<string,caseBody> testFuncs;
namespace AC_OTE { namespace AC_OTE {
static TestEnvironment props;
static int nCases; static int nCases;
testCases theseCases; testCases theseCases;
testFuncs theseFuncs; testFuncs theseFuncs;
static std::string TEST_SE =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\"><hello/></epp>";
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
auto_ptr<Session> sess(SessionFactory::newInstance(&props));
bool acTkInitialised = false, fatal = false, done = false, transferGainer; bool acTkInitialised = false, fatal = false, done = false, transferGainer;
@ -79,7 +66,7 @@ namespace AC_OTE {
try { try {
thisTest = Transaction(&oteCommand_1, &oteResponse_1); thisTest = Transaction(&oteCommand_1, &oteResponse_1);
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
catch(...) catch(...)
{ {
@ -102,7 +89,7 @@ namespace AC_OTE {
try { try {
thisTest = Transaction(&oteCommand_2, &oteResponse_2); thisTest = Transaction(&oteCommand_2, &oteResponse_2);
manager->execute(thisTest); ac_mgr->execute(thisTest);
theseLogs->logN(3,"(%d) Claims %s exist for %s.", theseLogs->logN(3,"(%d) Claims %s exist for %s.",
cmd,(chkRspE.doClaimsExist() ? "do" : " do not "),thisName); cmd,(chkRspE.doClaimsExist() ? "do" : " do not "),thisName);
if (chkRspE.doClaimsExist()) if (chkRspE.doClaimsExist())
@ -128,7 +115,7 @@ namespace AC_OTE {
oteCommand_3(thisName,pw,&RID, &tech, &ns, &admin, &billing); oteCommand_3(thisName,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3; DomainCreateResponse oteResponse_3;
thisTest = Transaction(&oteCommand_3, &oteResponse_3); thisTest = Transaction(&oteCommand_3, &oteResponse_3);
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
@ -146,7 +133,7 @@ namespace AC_OTE {
try { try {
thisTest = Transaction(&oteCommand_6, &oteResponse_6); thisTest = Transaction(&oteCommand_6, &oteResponse_6);
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
catch (EPPException& e) catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str(); { const char *eMsg = e.getMessage().c_str();
@ -170,7 +157,7 @@ namespace AC_OTE {
try { try {
thisTest = Transaction(&oteCommand_0, &oteResponse_0); thisTest = Transaction(&oteCommand_0, &oteResponse_0);
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
catch(const std::exception e) catch(const std::exception e)
{ {
@ -194,7 +181,7 @@ namespace AC_OTE {
try { try {
thisTest = Transaction(&oteCommand_7, &oteResponse_7); thisTest = Transaction(&oteCommand_7, &oteResponse_7);
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
catch (EPPException& e) catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str(); { const char *eMsg = e.getMessage().c_str();
@ -219,7 +206,7 @@ namespace AC_OTE {
try { try {
thisTest = Transaction(&oteCommand_5, &oteResponse_5); thisTest = Transaction(&oteCommand_5, &oteResponse_5);
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
catch (EPPException& e) catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str(); { const char *eMsg = e.getMessage().c_str();
@ -248,7 +235,7 @@ namespace AC_OTE {
thisTest = transferGainer ? Transaction(&oteCommand_4a, &oteResponse_4) : thisTest = transferGainer ? Transaction(&oteCommand_4a, &oteResponse_4) :
Transaction(&oteCommand_4b, &oteResponse_4) ; Transaction(&oteCommand_4b, &oteResponse_4) ;
manager->execute(thisTest); ac_mgr->execute(thisTest);
} }
catch(...) catch(...)
@ -293,86 +280,5 @@ namespace AC_OTE {
} }
} }
} // AC_OTE namespace
} // AC_OTE
using namespace AC_OTE;
bool ausRegEPPTK::registryXOTE()
{
bool debug=true; int i=0;
if (!acTkInitialised) {
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
acTkInitialised = true;
}
const Json::Value suite = root["testSuite00"];
if (!suite) {
theseLogs->logN(0,"'testSuite00' suite root not found, need it.");
return true;
}
for ( i = 0; i < suite.size(); ++i ) { const char *thisItem = suite[i].asString().c_str();
if (debug)
theseLogs->logN(1,"item %.",thisItem);
if (strncmp(thisItem,"case",4)) continue;
if (strlen(thisItem) != 6) continue;
if (debug)
theseLogs->logN(1,"case %.",thisItem);
if (!theseFuncs[thisItem]) {
theseLogs->logN(0,"No logic to bind to '%s', need it.");
return false;
}
theseCases[AC_OTE::nCases].parms = &suite[i];
theseCases[AC_OTE::nCases].fBody = theseFuncs[thisItem];
theseCases[AC_OTE::nCases++].caseName = thisItem;
}
while(!done) {
try {
Timer::setTime("20140101.010101");
op = "startup";
manager->startup();
op = "run (keep-alive)";
manager->run();
sess->open();
theseLogs->logN(2,"OTE %s [Hello] (%d).",thisAccount,cmd++);
sess->writeXML(TEST_SE);
sess->read();
for (i=0;i<theseCases.size();i++) {
theseLogs->logN(2,"%d (%s) Begin ",i,theseCases[i].caseName );
theseCases[i].fBody();
theseLogs->logN(2,"%d (%s) End ",i,theseCases[i].caseName );
}
theseLogs->logN(0,"End OTE Session.");
theseLogs->logN(0,"Restart with toolkit scenario >= 5 for production ops.");
sess->close();
manager->shutdown();
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
theseLogs->logN(2,"Outer EPP Exception during OTE (%s): %s .",opNow,eMsg);
throw e;
}
catch (...)
{
theseLogs->logN(2,"Outer General Exception in OTE (%s).",op.c_str());
}
}// debug while
}
#endif /* REGISTRY_X */ #endif /* REGISTRY_X */

View File

@ -34,13 +34,11 @@ class ausRegEPPTK {
ausRegEPPTK() { tkScenario=thisConfig->tkScenario; // Maybe R-R pair specific later ausRegEPPTK() { tkScenario=thisConfig->tkScenario; // Maybe R-R pair specific later
daysRunning = 0; daysRunning = 0;
} }
bool doNothing(const std::string propertiesFilePath); bool doNothing(const std::string propertiesFilePath);
void doOTEA(); void doOTEA();
void doOTEB(); void doOTEB();
void doOTEC(); void doPROD();
void doOTEP(); void registryXOTE();
bool registryXOTE();
bool walkDontRun();
bool walkAndRun();
}; };

View File

@ -11,7 +11,7 @@
void ausRegEPPTK::doOTEB() void ausRegEPPTK::doOTEB()
{ {
bool addDomains = false, debug=true, contactCreated = true, doTransfers = false, bool addDomains = false, debug=true, contactCreated = true, doTransfers = false,
transferGainer = false, doDPML=false; transferGainer = false, doDPML=true;
int cmd=0; int cmd=0;
const char *thatAccount="secura2-ote2", *thisAccount="secura1-ote"; const char *thatAccount="secura2-ote2", *thisAccount="secura1-ote";
@ -77,18 +77,24 @@ void ausRegEPPTK::doOTEB()
theseLogs->logN(1,"Continue OTE Transactions."); theseLogs->logN(1,"Continue OTE Transactions.");
sleep(2); sleep(2);
theseLogs->logN(2,"(%d) Non-LPE check of %s",cmd++,name1); theseLogs->logN(2,"(%d) Non-LPE check of %s",cmd++,name5);
DomainCheckCommand oteCommand_1(name1); DomainCheckCommand oteCommand_1(name5);
DomainCheckResponse oteResponse_1; DomainCheckResponse oteResponse_1;
try { try {
thisTest = Transaction(&oteCommand_1, &oteResponse_1); thisTest = Transaction(&oteCommand_1, &oteResponse_1);
manager->execute(thisTest); manager->execute(thisTest);
} }
catch(...) 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(0,"Case %d Failed, harness catch.",cmd++); theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str());
} }
theseLogs->logN(2,"(%d) Perform Claims type Check of %s",cmd++,name3); theseLogs->logN(2,"(%d) Perform Claims type Check of %s",cmd++,name3);
@ -207,7 +213,7 @@ void ausRegEPPTK::doOTEB()
} }
catch(...) catch(...)
{ {
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++); theseLogs->logN(1,"Case %d Failed, harness catch.",cmd++);
} }
} }
@ -237,8 +243,9 @@ void ausRegEPPTK::doOTEB()
} }
theseLogs->logN(2,"(%d) Create %s w Notice ID test data (TCN).",++cmd,name3); theseLogs->logN(2,"(%d) skip Create %s w Notice ID test data (TCN).",++cmd,name3);
if (0) { // done
string noticeID("d85159710000000000000008692"), string noticeID("d85159710000000000000008692"),
notAfter("2015-01-01T12:00:00Z"), acceptedDate("2014-01-27T19:00:00Z"); notAfter("2015-01-01T12:00:00Z"), acceptedDate("2014-01-27T19:00:00Z");
@ -261,8 +268,9 @@ void ausRegEPPTK::doOTEB()
{ {
theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str()); theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str());
} }
}
if (doDPML) { std::string dpmlName("face.dpml.zone"); if (doDPML) { std::string dpmlName("face.dpml.zone");
theseLogs->logN(2,"(%d) Create %s w ICANN SMD file.",++cmd,dpmlName.c_str()); theseLogs->logN(2,"(%d) Create %s w ICANN SMD file.",++cmd,dpmlName.c_str());

View File

@ -8,6 +8,23 @@
#ifndef MDJSON_HPP_ #ifndef MDJSON_HPP_
#define MDJSON_HPP_ #define MDJSON_HPP_
typedef void (*caseBody)(void);
typedef struct {
const char *caseName;
caseBody fBody;
const Json::Value *parms;
} testCase;
typedef std::map<int,testCase> testCases;
typedef std::map<string,caseBody> testFuncs;
#ifdef MD_JSON
static Json::Value root;
#else
extern Json::Value root;
#endif
class mdJSON { class mdJSON {
private: private:
@ -17,10 +34,12 @@ public:
bool fatal; bool fatal;
mdJSON (char *fileName); mdJSON() : fatal(false) {}
bool parse(); bool parse();
bool didDie() {return fatal;} bool didDie() {return fatal;}
void die(){ fatal = true;} void die(){ fatal = true;}
void setPath(char *filePath);
bool run();
}; };

View File

@ -244,23 +244,23 @@ void oteA() {
#endif #endif
} }
void oteC() { void otePROD() {
#if (ARTKENABLED > 0) #if (ARTKENABLED > 0)
int nthDay; int nthDay;
theseLogs->logNdebug(MAX_DEBUG,0,"JSON Scripted Directory Monitor/Executor BOJ"); theseLogs->logNdebug(MAX_DEBUG,0,"JSON Scripted Directory Monitor/Executor BOJ");
thisService->artk->doOTEC(); thisService->artk->registryXOTE();
theseLogs->logNdebug(MAX_DEBUG,0,"JSON Scripted Directory Monitor/Executor EOJ"); theseLogs->logNdebug(MAX_DEBUG,0,"JSON Scripted Directory Monitor/Executor EOJ");
#endif #endif
} }
void oteP() { void fullProduction() {
#if (ARTKENABLED > 0) #if (ARTKENABLED > 0)
int nthDay; int nthDay;
for (nthDay=0;nthDay<30;nthDay++) { for (nthDay=0;nthDay<30;nthDay++) {
theseLogs->logNdebug(MAX_DEBUG,1,"AC Production SoD %d",nthDay); theseLogs->logNdebug(MAX_DEBUG,1,"AC Production SoD %d",nthDay);
thisService->artk->doOTEP(); thisService->artk->doPROD();
theseLogs->logNdebug(MAX_DEBUG,1,"AC Production EoD %d",nthDay); theseLogs->logNdebug(MAX_DEBUG,1,"AC Production EoD %d",nthDay);
thisService->artk->daysRunning = nthDay; thisService->artk->daysRunning = nthDay;
@ -292,15 +292,15 @@ void masterDaemon::run() {
theseLogs->logNdebug(MAX_DEBUG,0,"OTE Basic Access Test EOJ."); theseLogs->logNdebug(MAX_DEBUG,0,"OTE Basic Access Test EOJ.");
} }
if (artk->tkScenario == ACTK_OTEC) { if (artk->tkScenario == ACTK_OTEC) {
boost::thread oteCrun(oteC); boost::thread prodInOTE(otePROD);
assert(oteCrun.joinable()); assert(prodInOTE.joinable());
oteCrun.join(); prodInOTE.join();
theseLogs->logNdebug(MAX_DEBUG,0,"OTE Full Access EOJ."); theseLogs->logNdebug(MAX_DEBUG,0,"OTE Full Access EOJ.");
} }
if (artk->tkScenario == ACTK_PROD) { if (artk->tkScenario == ACTK_PROD) {
boost::thread otePrun(oteC); boost::thread rxPROD(fullProduction);
assert(otePrun.joinable()); assert(rxPROD.joinable());
otePrun.join(); rxPROD.join();
theseLogs->logNdebug(MAX_DEBUG,0,"AC Production EOJ."); theseLogs->logNdebug(MAX_DEBUG,0,"AC Production EOJ.");
} }
#endif #endif

View File

@ -24,7 +24,8 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/inotify.h> #include <sys/inotify.h>
#include "mdJSON.hpp"" #include <json/json.h>
#include "mdJSON.hpp"
using namespace std; using namespace std;
@ -36,18 +37,21 @@ using namespace std;
//char *name6 = "shady.ventures"; // //char *name6 = "shady.ventures"; //
//char *name7 = "hemmarhoid.camera"; // //char *name7 = "hemmarhoid.camera"; //
//char *name3 = "pricey.holdings"; // //char *name3 = "pricey.holdings"; //
char *name1 = "yoda.guru"; const char *name1 = "yoda.guru";
char *name2 = "unicycles.bike"; const char *name2 = "unicycles.bike";
char *name3 = "test-validate.claimsgasix"; const char *name3 = "test-validate.claimsgasix";
char *name4 = "horny.singles"; const char *name4 = "horny.singles";
char *name5 = "atmospheric.lighting"; const char *name5 = "atmospheric.lighting";
char *name6 = "mushroomtheory.management"; const char *name6 = "mushroomtheory.management";
static TestEnvironment props; static TestEnvironment props;
static std::string TEST_SE = static std::string TEST_SE =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\"><hello/></epp>"; "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\"><hello/></epp>";
#include "AC_OTE.h"
// static void testExecuteParallelTransactions() throw (EPPException); // static void testExecuteParallelTransactions() throw (EPPException);
bool ausRegEPPTK::doNothing(const std::string propertiesFilePath) { // Just verify load bool ausRegEPPTK::doNothing(const std::string propertiesFilePath) { // Just verify load
@ -108,38 +112,61 @@ void ausRegEPPTK::doOTEA()
} }
} }
#include "donutsOTEB.h" #include "donutsOTEB.h"
void ausRegEPPTK::doOTEC() { void ausRegEPPTK::registryXOTE() { // PROD in OTE
// This scenario generalizes OTEB so that its operations can be performed // This scenario generalizes OTEB so that its operations can be performed
// by json scripting. This is a quick and dirty which can be extended in // by json scripting. This is a quick and clean which is meant to allow
// obvious ways and monitors a directory for new or changed files. // a Registrar to begin quasi-production ops from the established OTE
// baseline. It's main use case is scripted OTE ops however, it's not
// meant to be actual production.
bool actionableFileEvent,monitoring=true; bool actionableFileEvent,monitoring=true;
int length, i = 0; int length, i = 0, mSleeps=0, nSleeps=0,debug=10000;
int fd; int fd, wd;
int wd;
char buffer[BUF_LEN]; char buffer[BUF_LEN];
fd = inotify_init(); string op("newInstance");
if ( fd < 0 ) { scenario(thisConfig->tkScenario,thisConfig->cfg_path);
theseLogs->logN(0,"Fatal error, couldn't init inotify.");
return;
}
theseLogs->logN(0,"Monitoring ./json for changes."); try {
Timer::setTime("20140101.010101");
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
auto_ptr<Session> sess(SessionFactory::newInstance(&props));
op = "startup";
manager->startup();
op = "run (keep-alive)";
manager->run();
wd = inotify_add_watch( fd, "./json", IN_MODIFY | IN_CREATE | IN_DELETE ); sess->open();
length = read( fd, buffer, BUF_LEN ); theseLogs->logN(0,"Begin RegistryXOTE Session.");
sess->writeXML(TEST_SE);
sess->read();
if ( length < 0 ) { fd = inotify_init();
if ( fd < 0 ) {
theseLogs->logN(0,"Fatal error, couldn't init inotify.");
return;
}
ac_mgr = manager;
ac_sess = sess;
theseLogs->logN(0,"Monitoring ./json for changes.");
wd = inotify_add_watch( fd, "./json", IN_MODIFY | IN_CREATE | IN_DELETE );
length = read( fd, buffer, BUF_LEN );
if ( length < 0 ) {
theseLogs->logN(0,"Fatal error, initial inotify read failed."); theseLogs->logN(0,"Fatal error, initial inotify read failed.");
} }
while ( i < length && monitoring) while ( i < length && monitoring)
{ actionableFileEvent = false; { actionableFileEvent = false;
struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ]; struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ];
if ( event->len ) {
if ( event->mask & IN_CREATE ) { if ( event->len ) {
if ( event->mask & IN_CREATE ) {
if ( event->mask & IN_ISDIR ) { if ( event->mask & IN_ISDIR ) {
theseLogs->logN(1,"The directory %s was created.\n", event->name ); theseLogs->logN(1,"The directory %s was created.\n", event->name );
} }
@ -147,16 +174,16 @@ void ausRegEPPTK::doOTEC() {
theseLogs->logN(1,"The file %s was created.\n", event->name ); theseLogs->logN(1,"The file %s was created.\n", event->name );
actionableFileEvent = true; actionableFileEvent = true;
} }
} }
else if ( event->mask & IN_DELETE ) { else if ( event->mask & IN_DELETE ) {
if ( event->mask & IN_ISDIR ) { if ( event->mask & IN_ISDIR ) {
theseLogs->logN(1,"The directory %s was deleted.\n", event->name ); theseLogs->logN(1,"The directory %s was deleted.\n", event->name );
} }
else { else {
printf( "The file %s was deleted.\n", event->name ); printf( "The file %s was deleted.\n", event->name );
} }
} }
else if ( event->mask & IN_MODIFY ) { else if ( event->mask & IN_MODIFY ) {
if ( event->mask & IN_ISDIR ) { if ( event->mask & IN_ISDIR ) {
theseLogs->logN(1, "The directory %s was modified.\n", event->name ); theseLogs->logN(1, "The directory %s was modified.\n", event->name );
} }
@ -164,12 +191,14 @@ void ausRegEPPTK::doOTEC() {
theseLogs->logN(1, "The file %s was modified.\n", event->name ); theseLogs->logN(1, "The file %s was modified.\n", event->name );
actionableFileEvent = true; actionableFileEvent = true;
} }
} }
}
i += EVENT_SIZE + event->len; i += EVENT_SIZE + event->len;
if (actionableFileEvent) { mdJSON scriptor(event->name); if (actionableFileEvent) { char wxyz[100]; sprintf(wxyz,"./json/%s",event->name);
if (scriptor.parse()) { mdJSON scriptor;
if (registryXOTE()) { scriptor.setPath(wxyz);
if (scriptor.parse()) {
if (scriptor.run()) {
if (didDie) { if (didDie) {
monitoring = false; monitoring = false;
theseLogs->logN(1, "Run of %s fatal error. ./json monitoring stops.\n", event->name ); theseLogs->logN(1, "Run of %s fatal error. ./json monitoring stops.\n", event->name );
@ -180,19 +209,50 @@ void ausRegEPPTK::doOTEC() {
} else } else
theseLogs->logN(1, " %s completed OK. ./json monitoring continues. \n", event->name ); theseLogs->logN(1, " %s completed OK. ./json monitoring continues. \n", event->name );
}
else {
theseLogs->logN(1, "Parse of %s failed. ,/json monitoring continues.\n", event->name );
}
} }
else {
theseLogs->logN(1, "Parse of %s failed. ,/json monitoring continues.\n", event->name ); #define PRODINOTESLEEP 2
}
if (!(nSleeps % (60/PRODINOTESLEEP)))
theseLogs->logN(1,"Approximate AC PROD in OTE Hour %d.",(nSleeps/(60/PRODINOTESLEEP)));
if (mSleeps == (857/PRODINOTESLEEP)) {
sess->writeXML(TEST_SE);
sess->read();
mSleeps = 0;
}
sleep(PRODINOTESLEEP);
nSleeps++; mSleeps++;
if (debug > 999)
theseLogs->logN(2,"nSleeps: %d mSleeps %d.",nSleeps,mSleeps);
} // while monitoring
( void ) inotify_rm_watch( fd, wd );
( void ) close( fd );
} }
else sleep(1); theseLogs->logN(0,"End PROD in OTE Session.");
sess->close();
manager->shutdown();
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
theseLogs->logN(2,"Outer EPP Exception during PRODinOTE (%s): %s .",opNow,eMsg);
throw e;
}
catch (...)
{
theseLogs->logN(2,"Outer General Exception in OTE (%s).",op.c_str());
} }
( void ) inotify_rm_watch( fd, wd );
( void ) close( fd );
} }
void ausRegEPPTK::doOTEP() void ausRegEPPTK::doPROD()
{ {
int hours,hoops; int hours,hoops;
string op("newInstance"); string op("newInstance");

View File

@ -6,39 +6,18 @@
*/ */
#define MD_JSON #define MD_JSON
#include "cliever-md.h" #include "cliever-md.h"
#include "session/SessionFactory.hpp"
#include "session/SessionManagerProperties.hpp"
#include "session/Transaction.hpp"
#include "common/SystemProperties.hpp"
#include "session/Session.hpp"
#include "session/StatsManager.hpp"
#include "se/DomainCheckCommand.hpp"
#include "se/DomainCheckResponse.hpp"
#include "se/LPE/LPChkCmdExtension.hpp"
#include "se/LPE/LPChkRespExtension.hpp"
#include "se/LPE/LPCrtCmdExtension.hpp"
#include "se/LPE/LPCrtRespExtension.hpp"
#include "se/TransferOp.hpp"
#include "se/IntPostalInfo.hpp"
#include "se/ContactCreateCommand.hpp"
#include "se/ContactCreateResponse.hpp"
#include "se/DomainCreateCommand.hpp"
#include "se/DomainCreateResponse.hpp"
#include "se/DomainTransferApproveCommand.hpp"
#include "se/DomainTransferRequestCommand.hpp"
#include "se/DomainTransferResponse.hpp"
#include "mdJSON.hpp"
#include <algorithm> // sort #include <algorithm> // sort
#include <json/json.h> #include <json/json.h>
#include <stdio.h> #include <stdio.h>
#include "mdJSON.hpp"
static Json::Value root; namespace AC_OTE {
extern testCases theseCases;
extern testFuncs theseFuncs;
}
using namespace std; using namespace std;
#include "RegistryXOTE.h"
static std::string static std::string
readInputTestFile( const char *path ) readInputTestFile( const char *path )
{ {
@ -58,6 +37,55 @@ readInputTestFile( const char *path )
return text; return text;
} }
bool mdJSON::run()
{
bool done=false, debug=true; int i=0, nCases =0;
const Json::Value suite = root["testSuite00"];
if (!suite) {
theseLogs->logN(0,"No 'testSuite00' suite root, can't run.");
return true;
}
for ( i = 0; i < suite.size(); ++i ) { const char *thisItem = suite[i].asString().c_str();
if (debug)
theseLogs->logN(1,"item %.",thisItem);
if (strncmp(thisItem,"case",4)) continue;
if (strlen(thisItem) != 6) continue;
if (debug)
theseLogs->logN(1,"case %.",thisItem);
if (!AC_OTE::theseFuncs[thisItem]) {
theseLogs->logN(0,"No logic to bind to '%s', need it.");
return false;
}
AC_OTE::theseCases[nCases].parms = &suite[i];
AC_OTE::theseCases[nCases].fBody = AC_OTE::theseFuncs[thisItem];
AC_OTE::theseCases[nCases++].caseName = thisItem;
}
while(!done) {
try {
for (i=0;i<AC_OTE::theseCases.size();i++) {
theseLogs->logN(2,"%d (%s) Begin ",i,AC_OTE::theseCases[i].caseName );
AC_OTE::theseCases[i].fBody();
theseLogs->logN(2,"%d (%s) End ",i,AC_OTE::theseCases[i].caseName );
}
theseLogs->logN(0,"End OTE Session.");
theseLogs->logN(0,"Restart with toolkit scenario >= 5 for production ops.");
}
catch (...)
{
theseLogs->logN(0,"Inner JSON Execution in OTE ");
}
}
}
static bool static bool
parseValueTree( const std::string &input, const std::string &kind, Json::Value &root, const Json::Features &features) parseValueTree( const std::string &input, const std::string &kind, Json::Value &root, const Json::Features &features)
{ {
@ -99,9 +127,9 @@ bool mdJSON::parse()
return value; return value;
} }
mdJSON::mdJSON(char *fileName) { void mdJSON::setPath(char *fileName) {
//rrj path = string(fileName); path = string(fileName);
} }

95
json/OTEC.json Normal file
View File

@ -0,0 +1,95 @@
{
"_comment" : "mdJSON.cpp will try to bind data and run if it recognizes the leading field name."
"_comment" : "I'm using convention of inserting a hyphen to disable a test case."
"testSuite00": "Outer block of a set of inputs to mdJSON.cpp to be run by ausRegTK::registryXOTE()"
"testSuite00": "Repeat case name casexx as needed, to run needs logic bound in RegistryXOTE.h"
"testSuite-00" : {
"Registry" : "Donuts",
"AccountA" : "secura1-ote",
"AccountB" : "secura2-ote2",
"case00" : "Create a contact"
"case-00" : {
"cont_id": "renjuan",
"cont_pw": "Ab9dW@rd",
"cont_email": "juan@acm.org",
"cont-name": "Ren Ren-Juan",
"cont-city": "Niagara Falls",
"cont_street1: "2926 2nd Street",
"cont-province": NY",
"cont-postal-code": "14305",
"cont-guo": "US",
"cont-org": "American Kybernetik"
}
"case01" : "Conventional / Standard/ Unextended Check"
"case-01" : {
"name" : "bestever.camera"
}
"case02" : "Check with Claims Extension"
"case-02" : {
"name" : "unicycles.bike"
}
"case03" : "Conventional / Standard / Unextended Create"
"case-03" : {
"name" : "greedy.ventures"
}
"case04" : "DPML Create"
"case-04" : {
"name" : "face.dpml.zone"
"smd-data" : "./smd/face-test.smd"
}
"case00" : "Create another contact"
"case-00" : {
"cont_id": "renjuan2",
"cont_pw": "Ab9dW@rd",
"cont_email": "juan@acm.org",
"cont-name": "Ren Ren-Juan",
"cont-city": "Niagara Falls",
"cont_street1: "2926 2nd Street",
"cont-province": NY",
"cont-postal-code": "14305",
"cont-guo": "US",
"cont-org": "American Kybernetik"
}
"case04" : "DPML Create"
"case-04" : {
"name" : "secura.dpml.zone"
"smd-data" : "./smd/secura-test.smd"
}
"case05" : "Create with TCN Override"
"case-05" : {
"name" : "greedy.ventures"
"noticeID" : ""
"notBefore" : ""
"acceptedDate" : ""
}
}
}