From dbef59cf015c9705e3e5a6fd72ced71ef548d66f Mon Sep 17 00:00:00 2001 From: Ren RenJuan Date: Mon, 27 Jan 2014 17:24:42 +0000 Subject: [PATCH] * --- ACTK1_0/se/LPE/LPChkRespExtension.cpp | 18 +++--- ACTK1_0/se/LPE/LPChkRespExtension.hpp | 12 +++- AusRegCliever/server/mdAusReg.cpp | 80 ++++++++++++++++----------- 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/ACTK1_0/se/LPE/LPChkRespExtension.cpp b/ACTK1_0/se/LPE/LPChkRespExtension.cpp index e66d091..7cf74d4 100644 --- a/ACTK1_0/se/LPE/LPChkRespExtension.cpp +++ b/ACTK1_0/se/LPE/LPChkRespExtension.cpp @@ -7,6 +7,8 @@ extern mdLogger mdLog; +XALAN_USING_XALAN(XalanDOMString) + /* * Have to use static funcion instead of static variable * since there is not guarantee about the construct/destruct @@ -14,26 +16,26 @@ extern mdLogger mdLog; */ const std::string LPChkRespExtension::CKCLAIM_EXPR() { - return EXTENSION_EXPR() + "/launch:cd/launch:name"; + return EXTENSION_EXPR() + "//launch:name@exists"; } -LPChkRespExtension::LPChkRespExtension() : typeIsClaims(true) +LPChkRespExtension::LPChkRespExtension() : typeIsClaims(true), initialised(false) { } void LPChkRespExtension::fromXML(XMLDocument *xmlDoc) { - const std::string respElement = CKCLAIM_EXPR(); - const XalanNode * responSE = xmlDoc->getElement(respElement); - const std::string respAttr("exists"); + const std::string respElement = CKCLAIM_EXPR(); + const XalanNode * responSE = xmlDoc->getElement(respElement); + const XalanDOMString respValue("false"); + initialised = true; if (!responSE) { mdLog.logN(0,"Parse error in LPChkResponse"); } else { - if (responSE->getAttributes()) {} - - + if (responSE->getNodeValue().compare(respValue) != 0) + response = true; } diff --git a/ACTK1_0/se/LPE/LPChkRespExtension.hpp b/ACTK1_0/se/LPE/LPChkRespExtension.hpp index 186b682..803f230 100644 --- a/ACTK1_0/se/LPE/LPChkRespExtension.hpp +++ b/ACTK1_0/se/LPE/LPChkRespExtension.hpp @@ -13,17 +13,25 @@ class LPChkRespExtension : public ResponseExtension public: LPChkRespExtension(); - virtual void fromXML(XMLDocument *xmlDoc); - bool affirmativeResponse(); + virtual void fromXML(XMLDocument *xmlDoc); + bool affirmativeResponse(); + bool getClaimsStatus() { return response; } + virtual bool isInitialised() const; private: const XMLDocument *xmlDoc; bool typeIsClaims; // False implies type is availablity + bool initialised; bool response; // true/false attribute in reply static const std::string CKCLAIM_EXPR(); }; +inline bool LPChkRespExtension::isInitialised() const +{ + return initialised; +} + #endif /* LPCK_RESPONSE_EXTENSION_H_ */ diff --git a/AusRegCliever/server/mdAusReg.cpp b/AusRegCliever/server/mdAusReg.cpp index 1843394..c88b6b4 100644 --- a/AusRegCliever/server/mdAusReg.cpp +++ b/AusRegCliever/server/mdAusReg.cpp @@ -18,7 +18,8 @@ #include "se/ContactCreateResponse.hpp" #include "se/DomainCreateCommand.hpp" #include "se/DomainCreateResponse.hpp" -#include "se/DomainTransferCommand.hpp" +#include "se/DomainTransferApproveCommand.hpp" +#include "se/DomainTransferRequestCommand.hpp" #include "se/DomainTransferResponse.hpp" using namespace std; @@ -31,13 +32,13 @@ using namespace std; // : PostalInfo (type, name, org, street, city, state, pc, guo) { }; //}; -char *name1 = "bestever.camera"; +char *name1 = "bestever.camera"; // char *name2 = "yoda.guru"; -char *name3 = "pricey.holdings"; +char *name3 = "pricey.holdings"; // char *name4 = "unicycles.bike"; -char *name5 = "greedy.ventures"; -char *name6 = "shady.ventures"; -char *name7 = "hemmarhoid.camera"; +char *name5 = "greedy.ventures"; // +char *name6 = "shady.ventures"; // +char *name7 = "hemmarhoid.camera"; // static TestEnvironment props; @@ -105,10 +106,10 @@ void ausRegEPPTK::doOTEA() } void ausRegEPPTK::doOTEB() { - bool addDomains = true, debug=true, contactCreated = true, doTransfers = false, + bool addDomains = false, debug=true, contactCreated = true, doTransfers = true, transferGainer = false; int cmd=0; - const char *thatAccount="secura2-ote", *thisAccount="secura1-ote"; + const char *thatAccount="secura2-ote2", *thisAccount="secura1-ote"; string op("newInstance"); const string claims("claims"), sunrise("sunrise"), @@ -130,14 +131,12 @@ void ausRegEPPTK::doOTEB() sess->open(); - theseLogs->logN(1,"OTE Basic Access [Hello] (%d).",cmd++); + 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 PostalInfoType *pits=new PostalInfoType(string("int")); - const std::string rrj("renjuan"); const std::string rrjPW("Ab9dW@rd"); const std::string rrjEmail("juan@acm.org"); @@ -221,7 +220,6 @@ void ausRegEPPTK::doOTEB() std::vector ns(1,std::string("ns1.google.com") );; - theseLogs->logN(2," (%d) create in OTE %s.",cmd++, thisAccount); LPCrtCmdExtension crtE1(&sunrise); if (addDomains) { @@ -229,24 +227,25 @@ void ausRegEPPTK::doOTEB() try { if (1) { - DomainCreateCommand - oteCommand_3(name3,pw,&RID, &tech, &ns, &admin, &billing); - oteCommand_3.appendExtension(crtE1); - DomainCreateResponse oteResponse_3; - LPCrtRespExtension crtRespE; - oteResponse_3.registerExtension(&crtRespE); + 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 (0) { - DomainCreateCommand - oteCommand_3a(name2,pw,&RID, &tech, &ns, &admin, &billing); - oteCommand_3a.appendExtension(crtE1); - DomainCreateResponse oteResponse_3a; + } 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); @@ -255,13 +254,14 @@ void ausRegEPPTK::doOTEB() thisTest = Transaction(&oteCommand_3b, &oteResponse_3b); manager->execute(thisTest); } if (0) { - DomainCreateCommand + 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); + manager->execute(thisTest); */ } } catch (EPPException& e) @@ -276,20 +276,37 @@ void ausRegEPPTK::doOTEB() } } - theseLogs->logN(4,"skip %s (%d) %s -> %s.", (transferGainer ? "Request" : "Approve") ,cmd++, name1,thatAccount); if (doTransfers) { - const TransferOp *thisTransfer = - transferGainer ? new TransferOp("request") : new TransferOp("approve") ; + // const TransferOp *thisTransfer = + // transferGainer ? new TransferOp("request") : new TransferOp("approve") ; - DomainTransferCommand - oteCommand_4(thisTransfer,name1); + 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 { - thisTest = Transaction(&oteCommand_4, &oteResponse_4); + 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); } @@ -342,6 +359,7 @@ void ausRegEPPTK::doOTEB() theseLogs->logN(1,"General Exception OTE B (%s).",op.c_str()); } + theseLogs->logN(0,"End OTE Session."); sess->close();