This commit is contained in:
Ren RenJuan 2014-01-28 18:16:48 +00:00
parent dbef59cf01
commit c8a6ba960d
21 changed files with 463 additions and 315 deletions

View File

@ -135,7 +135,9 @@ build/ContactNotificationResponse.o build/DomainSecDNSUpdateCommandExtensi
build/ContactTransferResponse.o build/DomainTransferResponse.o build/init.o build/Period.o build/SecDNSRemType.o build/UserPassMismatchException.o \
build/ContactUpdateCommand.o build/DomainUpdateCommand.o build/IPVersion.o build/PeriodUnit.o build/SendSE.o build/XMLDocument.o \
build/CreateResponse.o build/DomainUpdateSyncCommandExtension.o build/KVExtension.o build/PollOperation.o build/SessionFactory.o \
build/DataResponse.o build/E164Extension.o build/Logger.o build/PollResponse.o build/SessionManagerFactory.o \
build/DataResponse.o build/E164Extension.o build/Logger.o \
build/SMDExtension.o build/ACProxyCommand.o \
build/PollResponse.o build/SessionManagerFactory.o \
build/Disclose.o build/EnumDomainCreateCommand.o build/LoginCommand.o build/PostalInfo.o build/SessionManagerImpl.o
.PHONY: tests

View File

@ -1,10 +1,10 @@
#include "common/ErrorPkg.hpp"
#include "se/CLTRID.hpp"
#include "se/IllegalArgException.hpp"
#include "se/ACExtensionCommand.hpp"
#include "se/ACProxyCommand.hpp"
#include "xml/XMLHelper.hpp"
ACExtensionCommand::ACExtensionCommand(
ACProxyCommandCommand::ACProxyCommandCommand(
const CommandType* commandType,
const ObjectType* objectType,
const std::string& ident,
@ -36,7 +36,7 @@ ACExtensionCommand::ACExtensionCommand(
}
std::string ACExtensionCommand::toXMLImpl()
std::string ACProxyCommandCommand::toXMLImpl()
{
XMLHelper::setTextContent(
xmlWriter->appendChild(command, "clTRID"),

View File

@ -14,10 +14,10 @@
* class are responsible for building the part of the XML DOM tree common to
* all ACTK 1.0 protocol extension commands.
*/
class ACExtensionCommand : public SendSE
class ACProxyCommandCommand : public SendSE
{
public:
ACExtensionCommand(
ACProxyCommandCommand(
const CommandType* commandType,
const ObjectType* objectType,
const std::string& ident,

View File

@ -1,13 +1,21 @@
#include "se/LPE/LPChkCmdExtension.hpp"
#include "se/Command.hpp"
#include "se/LPE/LPExtension.hpp"
#include "se/LPE/SMDExtension.hpp"
#include "xml/XMLHelper.hpp"
namespace {
LPExtension& lpExtension() {
static LPExtension* lpExtension = new LPExtension();
return *lpExtension;
}
SMDExtension& smdExtension() {
static SMDExtension* smdExtension = new SMDExtension();
return *smdExtension;
}
}; // anonymous namespace
void LPChkCmdExtension::addToCommand(const Command &command) const

View File

@ -3,11 +3,11 @@
#include "se/ResponseExtension.hpp"
#include "se/LPE/LPChkRespExtension.hpp"
#include <xalanc/XalanDOM/XalanNamedNodeMap.hpp>
#include <xalanc/XalanDOM/XalanDOMString.hpp>
//#include <xalanc/XalanDOM/XalanDOMString.hpp>
extern mdLogger mdLog;
XALAN_USING_XALAN(XalanDOMString)
//XALAN_USING_XALAN(XalanDOMString)
/*
* Have to use static funcion instead of static variable
@ -16,26 +16,36 @@ XALAN_USING_XALAN(XalanDOMString)
*/
const std::string LPChkRespExtension::CKCLAIM_EXPR()
{
return EXTENSION_EXPR() + "//launch:name@exists";
return EXTENSION_EXPR() + "//*/@exists";
}
const std::string LPChkRespExtension::CKKEY_EXPR()
{
return EXTENSION_EXPR() + "//launch:claimKey";
}
const char *LPChkRespExtension::getClaimsKey() { return claimsKey.c_str(); }
LPChkRespExtension::LPChkRespExtension() : typeIsClaims(true), initialised(false)
LPChkRespExtension::LPChkRespExtension() : typeIsClaims(true), initialised(false), response(false),
claimsKey("")
{
}
void LPChkRespExtension::fromXML(XMLDocument *xmlDoc)
{
const std::string ckeyElement = CKKEY_EXPR();
const std::string respElement = CKCLAIM_EXPR();
const XalanNode * responSE = xmlDoc->getElement(respElement);
const XalanDOMString respValue("false");
const std::string respValue = xmlDoc->getNodeValue(respElement);
const std::string doesntExist("false");
initialised = true;
if (!responSE) {
if (respValue.empty() ) {
mdLog.logN(0,"Parse error in LPChkResponse");
}
else {
if (responSE->getNodeValue().compare(respValue) != 0)
response = true;
if (respValue.compare(doesntExist) != 0) {
response = true;
const std::string claimKey= xmlDoc->getNodeValue(ckeyElement);
claimsKey = claimKey;
}
}

View File

@ -15,8 +15,9 @@ class LPChkRespExtension : public ResponseExtension
virtual void fromXML(XMLDocument *xmlDoc);
bool affirmativeResponse();
bool getClaimsStatus() { return response; }
virtual bool isInitialised() const;
bool doClaimsExist() { return response; }
virtual bool isInitialised() const;
const char *getClaimsKey();
private:
const XMLDocument *xmlDoc;
@ -26,6 +27,8 @@ class LPChkRespExtension : public ResponseExtension
bool response; // true/false attribute in reply
static const std::string CKCLAIM_EXPR();
static const std::string CKKEY_EXPR();
std::string claimsKey;
};

View File

@ -1,15 +1,27 @@
#include "se/LPE/LPCrtCmdExtension.hpp"
#include "se/Command.hpp"
#include "se/LPE/LPExtension.hpp"
#include "se/LPE/SMDExtension.hpp"
#include "xml/XMLHelper.hpp"
namespace {
LPExtension& lpExtension() {
static LPExtension* lpExtension = new LPExtension();
return *lpExtension;
}
}
SMDExtension& smdExtension() {
static SMDExtension* smdExtension = new SMDExtension();
return *smdExtension;
}
}; // anonymous namespace
void LPCrtCmdExtension::setSMD()
{
haveSMD = true;
}
void LPCrtCmdExtension::addToCommand(const Command &command) const
{
XMLWriter* xmlWriter = command.getXmlWriter();
@ -18,4 +30,39 @@ void LPCrtCmdExtension::addToCommand(const Command &command) const
"create", lpExtension().getURI());
DOMElement* exPhaseElement = xmlWriter->appendChild(launchElement, "launch:phase");
XMLHelper::setTextContent(exPhaseElement, lpePhaseName);
if (haveNoticeID) {
DOMElement* noticeElement = xmlWriter->appendChild(launchElement, "launch:notice");
DOMElement* exPhaseElement1 = xmlWriter->appendChild(noticeElement, "launch:noticeID");
XMLHelper::setTextContent( exPhaseElement1, noticeID );
DOMElement* exPhaseElement2 = xmlWriter->appendChild(noticeElement, "launch:notAfter");
XMLHelper::setTextContent( exPhaseElement2, notAfter );
DOMElement* exPhaseElement3 = xmlWriter->appendChild(noticeElement, "launch:acceptedDate");
XMLHelper::setTextContent( exPhaseElement3, acceptedDate );
}
if (haveSMD) { const string smd_id("1-2");
const string notBefore("2009-08-16T09:00:00.0Z"); const string notAfter("2099-08-16T09:00:00.0Z");
DOMElement* createLPElement = xmlWriter->appendChild(extensionElement, "launch:create");
DOMElement* smdElement = xmlWriter->appendChild(extensionElement,
"signedMark", smdExtension().getURI());
DOMElement* smdElement1 = xmlWriter->appendChild(smdElement, "smd:id");
XMLHelper::setTextContent( smdElement1, smd_id );
DOMElement* smdElement2 = xmlWriter->appendChild(smdElement, "smd:notBefore");
XMLHelper::setTextContent( smdElement2, notBefore );
DOMElement* smdElement3 = xmlWriter->appendChild(smdElement, "smd:notAfter");
XMLHelper::setTextContent( smdElement3, notAfter );
DOMElement* smdElement4 = xmlWriter->appendChild(smdElement, "smd:endcodedSignedMark");
XMLHelper::setTextContent( smdElement4, smdData );
}
}

View File

@ -8,19 +8,28 @@
#include "se/CommandExtension.hpp"
#include "se/IllegalArgException.hpp"
using namespace std;
class LPCrtCmdExtension : public CommandExtension
{
public:
LPCrtCmdExtension(const std::string *phaseName);
LPCrtCmdExtension (const std::string *phaseName);
virtual void addToCommand(const Command &command) const;
bool hasNoticeID() {return haveNoticeID;}
void setNoticeID(string &idVal,string &notAftVal, string &acceptedVal) {
noticeID = idVal; notAfter = notAftVal; acceptedDate = acceptedVal; haveNoticeID = true;
}
void setSMD();
private:
bool haveNoticeID,haveSMD;
std::string lpePhaseName;
std::string noticeID;
std::string notAfter;
std::string acceptedDate;
};
inline LPCrtCmdExtension::LPCrtCmdExtension(
const std::string *phaseName)
inline LPCrtCmdExtension::LPCrtCmdExtension( const std::string *phaseName)
{
if (phaseName == NULL)
{
@ -29,6 +38,83 @@ inline LPCrtCmdExtension::LPCrtCmdExtension(
}
lpePhaseName = std::string(*phaseName);
haveNoticeID = haveSMD = false;
}
#endif // __DOMAIN_UPDATE_COMMAND_EXTENSION_HPP
// just here for exploratory purposes
static const string smdData(
"DQo8c21kOnNpZ25lZE1hcmsgeG1sbnM6c21kPSJ1cm46aWV0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cktSUGpReWxnR1V6"
"eXQxVS9tbVBrQ0JCd0ZWWCtlWkY1UjZmdFJDN1ZnaWFLZ3VTYlNyUjVuRjRpUzZXQUVtakdMZ01v"
"RHhzUU5KM3RSQUJMUGJSTHVIYVUxWjZ2UmRtQ3VMczVrcVFTWThZZXB1bGJaYnRyY3hEQU1BcE5q"
"SHVSc2M0a0NSZ1VvNlFHVG1zbTwvWDUwOUNlcnRpZmljYXRlPjwvWDUwOURhdGE+PC9LZXlJbmZv"
"PjwvU2lnbmF0dXJlPjwvc21kOnNpZ25lZE1hcms+");

View File

@ -0,0 +1,31 @@
/*
* SMDExtension.cpp
*
* Created on: Jan 28, 2014
* Author: jdaugherty
*/
#include "SMDExtension.hpp"
SMDExtension::SMDExtension() {
// TODO Auto-generated constructor stub
}
SMDExtension::~SMDExtension() {
// TODO Auto-generated destructor stub
}
std::string& SMDExtension::getURI() const
{
static std::string uri = "urn:ietf:params:xml:ns:signedMark-1.0";
return uri;
}
std::string& SMDExtension::getSchemaLocation() const
{
static std::string loc = "urn:ietf:params:xml:ns:signedMark-1.0 signedMark-1.0.xsd";
return loc;
}

View File

@ -0,0 +1,21 @@
/*
* SMDExtension.hpp
*
* Created on: Jan 28, 2014
* Author: jdaugherty
*/
#ifndef SMDEXTENSION_HPP_
#define SMDEXTENSION_HPP_
#include "se/Extension.hpp"
class SMDExtension: public Extension {
public:
SMDExtension();
virtual ~SMDExtension();
std::string& getURI() const;
std::string& getSchemaLocation() const;
};
#endif /* SMDEXTENSION_HPP_ */

View File

@ -40,6 +40,13 @@ ACSession::ACSession(SessionManagerProperties* props)
ACSession::~ACSession()
{ }
void ACSession::proxy(string XML,string commandMonicker) {
}
void ACSession::run() {
mdLog.logN(1,"Begin Toolkit Scenario %d Session",tkScenario);

View File

@ -5,9 +5,12 @@
#include "session/SessionPool.hpp"
#include "session/SessionManagerImpl.hpp"
#include <memory>
#include <queue>
#include <pthread.h>
#include <mdLogger.h>
#define SANS_BOOST
#include <string.h>
#include <mdcommon.h>
class ACSession : public SessionManagerImpl
{
@ -19,8 +22,23 @@
void shutdown();
void run();
void proxy(std::string XML,std::string command); // for submissions received from the MD
// command is either the lower case standard command or something else if a variant
// such as an extension is intended. There are three levels: base IETF standards
// unextended commands. Commands with hardcoded extensions, e.g. LPE, KV, E164,
// etc. which use the c++ SE camel case class name, or caps with underscore
// and a company prefix if custom biz rule engine.
void proxy(mdDatagram *incoming,std::string command);
// A msgpack dgram is received from a CD. This is a deliberately crude interface to
// short circuit full blown XML processing and drive the base and extended SEs but
// nothing else thru msgpack datagrams. Generalizing from mdAusReg.cpp:doOTEB this
// has scripting that as its intial use case. mdAusReg.cpp:doOTEC calls this interface
// as a proxy to execute the command (without
// OTEB case that uses plain c/c++,
// which is meant to be a rescripting of the OTEB test process giving an ability to
// drive the test process remotely if no recompile of the central AC programs is
// nee
};

Binary file not shown.

View File

@ -330,7 +330,7 @@ void mdCommander::say(char *what)
void mdCommander::greet() {
const char *title="AusReg Cliever Commander",
*warn="NB: this program is meant to be powerful and fast, not safe or user friendly",
*warn="NB: this program is meant to be powerful, reliable, and fast, not safe or user friendly",
*prompt="Enter ? or command";
sprintf(theBanner,banner,thisConfig->shellProcess,thisConfig->daemonProcess);
@ -404,6 +404,13 @@ void mdCommander::eppMainMenu() {
mvprintw(16,50," n = 1 : epp-1.0.xsd 2: domain-1-0.xsd 3: contact-1.0.xsd");
mvprintw(17,50," 4: registrant-1.0.xsd 5: host-1-0.xsd 6: kv-1.0.xsd");
mvprintw(18,50," 7: launch-1.0.xsd 8: mark-1-0.xsd 9: signedMark-1.0.xsd");
mvprintw(20,70,"Commands are actually executed by the AC master daemon using,");
mvprintw(21,70,"either the standard defined transactions or specific boost ");
mvprintw(22,70,"FSM implementations (AC BRE) with proprietary biz rules");
mvprintw(23,70,"so use the mlog command to track execution,");
say((char *)"Action sequence or ? to exit");
}

View File

@ -2,6 +2,7 @@
#define MD_CHARGUI
#define MAX_CMDS 20
#define MAX_FSM 20
typedef
struct {
@ -13,15 +14,17 @@
typedef
struct {
void *schema;
char *xml; // For the ad-hoc write, the internals store uses a convention
void *schema[9];
char *xml; // For the ad-hoc write, the internals store uses a convention
}
eppXML;
typedef
struct {
bool hasXML:1;
bool reserved:7;
bool hasXML:1;
bool reserved:7;
void bre[MAX_FSM];
char *fsm[MAX_FSM]; // by which known at MD
}
eppState;
@ -36,7 +39,7 @@ class mdCommander {
eppXML xmlIO[9];
eppState state[MAX_CMDS];
char wwork[1024];
char* schemaFileNames[6];
char* schemaFileNames[9];
public:
@ -62,6 +65,21 @@ class mdCommander {
schemaFileNames[3]="registrant-1.0.xsd";
schemaFileNames[4]="host-1.0.xsd";
schemaFileNames[5]="kv-1.0.xsd";
schemaFileNames[6]="launch-1.0.xsd";
schemaFileNames[7]="mark-1.0.xsd";
schemaFileNames[8]="signedMark-1.0.xsd";
state[0].fsm[0] = "Check" ;
state[0].fsm[1] = "Check (LPE claims)" ;
state[1].fsm[0] = "Info" ;
state[2].fsm[0] = "Transfer Query" ;
state[3].fsm[0] = "Poll" ;
state[4].fsm[0] = "Create ";
state[4].fsm[1] = "Create (LPE) ";
state[5].fsm[0] = "Renew" ;
state[6].fsm[0] = "Update";
state[7].fsm[0] = "Delete";
state[8].fsm[0] = "Transfer";
}
~mdCommander() {}

View File

@ -63,7 +63,7 @@ endif
SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp -l ACTK1_0
DLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp
SINCL= -I include -I /usr/include/log4cpp $(BOSINCL)
SINCL= -I include -I /usr/include/log4cpp -I /usr/include/jsoncpp $(BOSINCL)
CFLAGS= -DCURRENT_DEBUG=1000 -ggdb3 -DARTKENABLED=$(ARTKENABLED) -DAC_MD
#

View File

@ -0,0 +1,25 @@
/*
* mdJSON.hpp
*
* Created on: Jan 28, 2014
* Author: jdaugherty
*/
#ifndef MDJSON_HPP_
#define MDJSON_HPP_
class mdJSON {
private:
static bool parsedOK;
std::string script;
public:
mdJSON(char *fileName);
~mdJSON();
bool run();
bool didParseOK();
};
#endif /* MDJSON_HPP_ */

View File

@ -55,12 +55,16 @@
#ifndef MD_COMMON
#define MD_COMMON
#ifndef SANS_BOOST
#include<boost/asio/datagram_socket_service.hpp>
#endif
using namespace std;
#ifndef SANS_BOOST
using boost::asio::ip::udp;
#endif
#define MAX_SCENARIO 1 // defined by increasing assumption of control from TK
#define MAX_SCENARIO 4 // defined by increasing assumption of control from TK
#define MAX_AC 1
#define MAX_CLIENTS 1
#define MAX_CLIEVER 10
@ -214,8 +218,8 @@ extern const char *clientTypes[N_MDDEV_TYPES];
/* \brief mdProcess
* Abstract base class of various subprocesses
*
* AC is (potentially) a distributed system with various subprocesses
* spanning the central server, the 'Cliever' middleware component and clients.
* AC is a distributed system with various subprocesses
* spanning the central server, the 'Cliever' and other programs using their interfaces.
* Root class for these.
*
*/
@ -256,6 +260,7 @@ struct {
unsigned reserved:30;
} mdCnctBool;
#ifndef SANS_BOOST
typedef
struct MD_CONTROL_BLOCK
{int handle; // debug mark
@ -483,6 +488,7 @@ class mdDGChannel
};
#endif // ifndef SANS_BOOST
typedef std::map<int,std::string> mdErrMsgMap;

View File

@ -248,9 +248,9 @@ void oteC() {
#if (ARTKENABLED > 0)
int nthDay;
theseLogs->logNdebug(MAX_DEBUG,0,"OTE Full Access BOJ");
thisService->artk->doOTEB();
theseLogs->logNdebug(MAX_DEBUG,0,"OTE Full Access end of Batch");
theseLogs->logNdebug(MAX_DEBUG,0,"JSON Scripted Directory Monitor/Executor BOJ");
thisService->artk->doOTEC();
theseLogs->logNdebug(MAX_DEBUG,0,"JSON Scripted Directory Monitor/Executor EOJ");
#endif
}

View File

@ -21,24 +21,27 @@
#include "se/DomainTransferApproveCommand.hpp"
#include "se/DomainTransferRequestCommand.hpp"
#include "se/DomainTransferResponse.hpp"
#include <errno.h>
#include <sys/types.h>
#include <sys/inotify.h>
#include "mdJSON.hpp""
using namespace std;
//class RRJPI : public PostalInfo {
// public:
// RRJPI(const PostalInfoType *type,const string& name, const string& org,
// const std::vector<std::string>& street, const string& city,
// const string& state,const string& pc, const string& guo)
// : PostalInfo (type, name, org, street, city, state, pc, guo) { };
//};
char *name1 = "bestever.camera"; //
char *name2 = "yoda.guru";
char *name3 = "pricey.holdings"; //
char *name4 = "unicycles.bike";
char *name5 = "greedy.ventures"; //
char *name6 = "shady.ventures"; //
char *name7 = "hemmarhoid.camera"; //
#define EVENT_SIZE ( sizeof (struct inotify_event) )
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
//char *name1 = "bestever.camera"; //
//char *name3 = "pricey.holdings"; //
//char *name5 = "greedy.ventures"; //
//char *name6 = "shady.ventures"; //
//char *name7 = "hemmarhoid.camera"; //
//char *name3 = "pricey.holdings"; //
char *name1 = "yoda.guru";
char *name2 = "unicycles.bike";
char *name3 = "test-validate.claimsgasix";
char *name4 = "horny.singles";
char *name5 = "atmospheric.lighting";
char *name6 = "mushroomtheory.management";
static TestEnvironment props;
@ -104,282 +107,83 @@ void ausRegEPPTK::doOTEA()
theseLogs->logN(2,"General Exception during OTE A (%s).",op.c_str());
}
}
void ausRegEPPTK::doOTEB()
{
bool addDomains = false, debug=true, contactCreated = true, doTransfers = true,
transferGainer = false;
int cmd=0;
const char *thatAccount="secura2-ote2", *thisAccount="secura1-ote";
#include "donutsOTEB.h"
void ausRegEPPTK::doOTEC() {
// 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
// obvious ways and monitors a directory for new or changed files.
string op("newInstance");
const string claims("claims"), sunrise("sunrise"),
landrush("landrush");
bool actionableFileEvent,monitoring=true;
int length, i = 0;
int fd;
int wd;
char buffer[BUF_LEN];
Transaction thisTest;
fd = inotify_init();
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
if ( fd < 0 ) {
theseLogs->logN(0,"Fatal error, couldn't init inotify.");
return;
}
while(debug) { debug=false; // debugger needs this
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();
theseLogs->logN(0,"Monitoring ./json for changes.");
sess->open();
wd = inotify_add_watch( fd, "./json", IN_MODIFY | IN_CREATE | IN_DELETE );
length = read( fd, buffer, BUF_LEN );
theseLogs->logN(2,"OTE %s [Hello] (%d).",thisAccount,cmd++);
sess->writeXML(TEST_SE);
sess->read();
theseLogs->logN(1,"OTE Basic Access Setup (%d).",cmd++);
const std::string rrj("renjuan");
const std::string rrjPW("Ab9dW@rd");
const std::string rrjEmail("juan@acm.org");
const std::string rrjName("Ren Ren-Juan");
const std::string rrjCity("Niagara Falls");
const std::vector<std::string>
rrjCrib(1,"2926 2nd Strt");
const std::string rrjProv("NY");
const std::string rrjPC("14305");
const std::string rrjGuo("US");
const std::string rrjOrg("American Kybernetik");
const IntPostalInfo rrjPO(rrjName,rrjOrg,
rrjCrib,rrjCity,rrjProv,rrjPC,rrjGuo);
ContactCreateCommand oteCommand_0(rrj,rrjPW,&rrjPO,rrjEmail);
ContactCreateResponse oteResponse_0;
theseLogs->logN(1,"(skip) Create Contact(s).");
if (!contactCreated) try {
thisTest = Transaction(&oteCommand_0, &oteResponse_0);
manager->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++);
}
theseLogs->logN(1,"Continue OTE Transactions.");
sleep(2);
theseLogs->logN(1,"(%d) Non-LPE check of yoda.guru",cmd++);
DomainCheckCommand oteCommand_1(name2);
DomainCheckResponse oteResponse_1;
try {
thisTest = Transaction(&oteCommand_1, &oteResponse_1);
manager->execute(thisTest);
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
}
theseLogs->logN(1,"(%d) Perform Claims type Check of unicycles.bike",cmd++);
DomainCheckCommand oteCommand_2("unicycles.bike");
LPChkCmdExtension chkE(&claims);
oteCommand_2.appendExtension(chkE);
DomainCheckResponse oteResponse_2;
LPChkRespExtension chkRspE;
oteResponse_2.registerExtension(&chkRspE);
try {
thisTest = Transaction(&oteCommand_2, &oteResponse_2);
manager->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());
}
// Used in all of below
const std::string pw("Ab9dW@rd");
const std::string RID("renjuan");
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") );;
LPCrtCmdExtension crtE1(&sunrise);
if (addDomains) {
try {
if (1) {
theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, name6, thisAccount);
DomainCreateCommand
oteCommand_3(name6,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3;
thisTest = Transaction(&oteCommand_3, &oteResponse_3);
manager->execute(thisTest);
} if (1) {
theseLogs->logN(3," (%d) normal create %s in OTE %s.",cmd++, name7, thisAccount);
DomainCreateCommand
oteCommand_3a(name7,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3a;
thisTest = Transaction(&oteCommand_3a, &oteResponse_3a);
manager->execute(thisTest);
} if (0) {
theseLogs->logN(3," (%d) LPE create %s in OTE %s.",cmd++, name5, thisAccount);
DomainCreateCommand
oteCommand_3b(name5,pw,&RID, &tech, &ns, &admin, &billing);
oteCommand_3b.appendExtension(crtE1);
DomainCreateResponse oteResponse_3b;
thisTest = Transaction(&oteCommand_3b, &oteResponse_3b);
manager->execute(thisTest);
} if (0) {
theseLogs->logN(3," (%d) LPE create %s in OTE %s.",cmd++, name4, thisAccount);
/* DomainCreateCommand
oteCommand_3c(name4,pw,&RID, &tech, &ns, &admin, &billing);
oteCommand_3c.appendExtension(crtE1);
DomainCreateResponse oteResponse_3c;
thisTest = Transaction(&oteCommand_3c, &oteResponse_3c);
manager->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());
}
}
if (doTransfers) {
// const TransferOp *thisTransfer =
// transferGainer ? new TransferOp("request") : new TransferOp("approve") ;
DomainTransferRequestCommand
oteCommand_4a(name1,rrjPW);
DomainTransferApproveCommand
oteCommand_4b(name1,rrjPW);
DomainTransferResponse oteResponse_4;
DomainTransferRequestCommand
oteCommand_4c(name7,rrjPW);
DomainTransferApproveCommand
oteCommand_4d(name7,rrjPW);
DomainTransferResponse oteResponse_4a;
try {
theseLogs->logN(4," %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, name1,thatAccount);
thisTest = transferGainer ? Transaction(&oteCommand_4a, &oteResponse_4) :
Transaction(&oteCommand_4b, &oteResponse_4) ;
manager->execute(thisTest);
theseLogs->logN(4," %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, name7,thatAccount);
thisTest = transferGainer ? Transaction(&oteCommand_4c, &oteResponse_4a) :
Transaction(&oteCommand_4d, &oteResponse_4) ;
manager->execute(thisTest);
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
}
}
theseLogs->logN(2,"(%d) Sunrise create %s with ICANN SMD test files.",cmd++,name5);
DomainCreateCommand oteCommand_5(name5,pw,&RID, &tech, &ns, &admin, &billing);
oteCommand_5.appendExtension(crtE1);
DomainCreateResponse oteResponse_5;
try {
thisTest = Transaction(&oteCommand_5, &oteResponse_5);
manager->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());
}
theseLogs->logN(1,"(%d) Create test-validate.claimsgasix (TCN).",cmd++);
DomainCreateCommand oteCommand_6("test-validate.claimsgasix",pw,&RID, &tech, &ns, &admin, &billing);
oteCommand_6.appendExtension(crtE1);
DomainCreateResponse oteResponse_6;
try {
thisTest = Transaction(&oteCommand_6, &oteResponse_6);
manager->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());
}
theseLogs->logN(0,"End OTE Session.");
sess->close();
manager->shutdown();
if ( length < 0 ) {
theseLogs->logN(0,"Fatal error, initial inotify read failed.");
}
while ( i < length && monitoring)
{ actionableFileEvent = false;
struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ];
if ( event->len ) {
if ( event->mask & IN_CREATE ) {
if ( event->mask & IN_ISDIR ) {
theseLogs->logN(1,"The directory %s was created.\n", event->name );
}
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;
else {
theseLogs->logN(1,"The file %s was created.\n", event->name );
actionableFileEvent = true;
}
catch (...)
{
theseLogs->logN(2,"Outer General Exception in OTE (%s).",op.c_str());
}
else if ( event->mask & IN_DELETE ) {
if ( event->mask & IN_ISDIR ) {
theseLogs->logN(1,"The directory %s was deleted.\n", event->name );
}
else {
printf( "The file %s was deleted.\n", event->name );
}
}
else if ( event->mask & IN_MODIFY ) {
if ( event->mask & IN_ISDIR ) {
theseLogs->logN(1, "The directory %s was modified.\n", event->name );
}
else {
theseLogs->logN(1, "The file %s was modified.\n", event->name );
actionableFileEvent = true;
}
}
}
i += EVENT_SIZE + event->len;
if (actionableFileEvent) { mdJSON scriptor(event->name);
if (scriptor.didParseOK()) {
if (!scriptor.run()) { monitoring = false;
theseLogs->logN(1, "Run of %s failed. ,/json monitoring stops.\n", event->name );
}
}
else {
theseLogs->logN(1, "Parse of %s failed. ,/json monitoring continues.\n", event->name );
}
}
else sleep(1);
}
( void ) inotify_rm_watch( fd, wd );
( void ) close( fd );
}// debug while
}
void ausRegEPPTK::doOTEP()
{
int hours,hoops;

View File

@ -0,0 +1,55 @@
/*
* mdJSON.cpp
*
* Created on: Jan 28, 2014
* Author: jdaugherty
*/
#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"
using namespace std;
mdJSON::mdJSON(char *fileName) {
script = string(fileName);
}
mdJSON::~mdJSON() {
// TODO Auto-generated destructor stub
}
mdJSON::mdJSON(char *script) {
}
bool mdJSON::run() {
}
bool mdJSON::didParseOK() {
done: return true;
}