351 lines
12 KiB
C++
351 lines
12 KiB
C++
#define MD_AUSREG
|
|
#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 "OTE/LPECheckCommand.hpp"
|
|
#include "OTE/LPECheckResponse.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/DomainTransferCommand.hpp"
|
|
#include "se/DomainTransferResponse.hpp"
|
|
#include "OTE/LPECreateCommand.hpp"
|
|
#include "OTE/LPECreateResponse.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";
|
|
|
|
static TestEnvironment props;
|
|
|
|
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>";
|
|
|
|
// static void testExecuteParallelTransactions() throw (EPPException);
|
|
|
|
bool ausRegEPPTK::doNothing(const std::string propertiesFilePath) { // Just verify load
|
|
|
|
bool did=false;
|
|
|
|
try {
|
|
scenario( 0, propertiesFilePath ); // tkScenario 0 assumed
|
|
did = true;
|
|
}
|
|
catch(std::exception &e) {
|
|
theseLogs->logN(2,"Scenario %d TK Exception: %s .",tkScenario,e.what());
|
|
}
|
|
return did;
|
|
|
|
}
|
|
void ausRegEPPTK::doOTEA()
|
|
{
|
|
int hours,hoops;
|
|
string op("newInstance");
|
|
|
|
scenario(tkScenario,thisConfig->cfg_path);
|
|
|
|
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();
|
|
sess->open();
|
|
|
|
for (hours=0;hours < 24;hours++) {
|
|
// Spawn the keep alive thread.
|
|
theseLogs->logN(1,"Send Test SEs on or about start OTE Test Hour %d.",hours);
|
|
|
|
for (hoops=0;hoops<7;hoops++) {
|
|
sess->writeXML(TEST_SE);
|
|
sess->read();
|
|
sleep(857);
|
|
}
|
|
|
|
}
|
|
sess->close();
|
|
manager->shutdown();
|
|
|
|
}
|
|
catch (EPPException& e)
|
|
{ const char *eMsg = e.getMessage().c_str();
|
|
const char *opNow = op.c_str();
|
|
theseLogs->logN(2,"EPP Exception during OTE A (%s): %s .",opNow,eMsg);
|
|
throw e;
|
|
}
|
|
catch (...)
|
|
{
|
|
theseLogs->logN(2,"General Exception during OTE A (%s).",op.c_str());
|
|
}
|
|
}
|
|
void ausRegEPPTK::doOTEB()
|
|
{
|
|
bool addDomains = true, debug=true, contactCreated = true, doTransfers = false,
|
|
transferGainer = false;
|
|
int cmd=0;
|
|
const char *thatAccount="secura2-ote", *thisAccount="secura1-ote";
|
|
|
|
string op("newInstance");
|
|
Transaction thisTest;
|
|
|
|
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
|
|
|
|
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();
|
|
|
|
sess->open();
|
|
|
|
theseLogs->logN(1,"OTE Basic Access [Hello] (%d).",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");
|
|
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 baCommand_0(rrj,rrjPW,&rrjPO,rrjEmail);
|
|
ContactCreateResponse baResponse_0;
|
|
|
|
if (!contactCreated) try {
|
|
thisTest = Transaction(&baCommand_0, &baResponse_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 Basic Access OTE Transactions.");
|
|
sleep(2);
|
|
theseLogs->logN(1,"(%d) Conventional check of yoda.guru",cmd++);
|
|
|
|
DomainCheckCommand baCommand_1(name2);
|
|
DomainCheckResponse baResponse_1;
|
|
|
|
try {
|
|
thisTest = Transaction(&baCommand_1, &baResponse_1);
|
|
manager->execute(thisTest);
|
|
}
|
|
catch(...)
|
|
{
|
|
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
|
|
}
|
|
|
|
theseLogs->logN(1,"(%d) LPE Check of unicycles.bike",cmd++);
|
|
|
|
LPECheckCommand baCommand_2("unicycles.bike");
|
|
LPECheckResponse baResponse_2;
|
|
|
|
thisTest = Transaction(&baCommand_2, &baResponse_2);
|
|
manager->execute(thisTest);
|
|
|
|
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") );;
|
|
|
|
// admin.push_back(std::string("Administration"));
|
|
// tech.push_back(std::string("Technical"));
|
|
// billing.push_back(std::string("Billing"));
|
|
// ns.push_back(std::string("ns1.google.com"));
|
|
|
|
try { theseLogs->logN(2,"skip: (%d) LPE create more using OTE %s.",cmd++,
|
|
thisAccount);
|
|
|
|
if (addDomains) {
|
|
|
|
DomainCreateCommand
|
|
baCommand_3(name3,pw,&RID, &tech, &ns, &admin, &billing);
|
|
DomainCreateResponse baResponse_3;
|
|
|
|
thisTest = Transaction(&baCommand_3, &baResponse_3);
|
|
manager->execute(thisTest);
|
|
|
|
DomainCreateCommand
|
|
baCommand_3a(name2,pw,&RID, &tech, &ns, &admin, &billing);
|
|
DomainCreateResponse baResponse_3a;
|
|
|
|
thisTest = Transaction(&baCommand_3a, &baResponse_3a);
|
|
manager->execute(thisTest);
|
|
|
|
DomainCreateCommand
|
|
baCommand_3b(name5,pw,&RID, &tech, &ns, &admin, &billing);
|
|
DomainCreateResponse baResponse_3b;
|
|
|
|
thisTest = Transaction(&baCommand_3b, &baResponse_3b);
|
|
manager->execute(thisTest);
|
|
|
|
DomainCreateCommand
|
|
baCommand_3c(name4,pw,&RID, &tech, &ns, &admin, &billing);
|
|
DomainCreateResponse baResponse_3c;
|
|
|
|
thisTest = Transaction(&baCommand_3c, &baResponse_3c);
|
|
manager->execute(thisTest);
|
|
|
|
}
|
|
}
|
|
catch(...)
|
|
{
|
|
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
|
|
}
|
|
|
|
theseLogs->logN(2,"%s (%d) %s -> %s.",
|
|
(transferGainer ? "Request" : "Approve"),cmd++,
|
|
name1,thatAccount);
|
|
|
|
if (doTransfers) {
|
|
|
|
const TransferOp *thisTransfer =
|
|
transferGainer ? new TransferOp("request") : new TransferOp("approve") ;
|
|
|
|
DomainTransferCommand
|
|
baCommand_4(thisTransfer,name1);
|
|
DomainTransferResponse baResponse_4;
|
|
|
|
try {
|
|
|
|
thisTest = Transaction(&baCommand_4, &baResponse_4);
|
|
manager->execute(thisTest);
|
|
|
|
}
|
|
catch(...)
|
|
{
|
|
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
|
|
}
|
|
|
|
}
|
|
|
|
theseLogs->logN(1,"(%d) Sunrise create %s with ICANN SMD test files.",cmd++,name5);
|
|
|
|
LPECreateCommand baCommand_5(name5,pw,&RID, &tech, &ns, &admin, &billing);
|
|
LPECreateResponse baResponse_5;
|
|
|
|
thisTest = Transaction(&baCommand_5, &baResponse_5);
|
|
manager->execute(thisTest);
|
|
|
|
theseLogs->logN(1,"(%d) Create test-validate.claimsgasix (TCN).",cmd++);
|
|
|
|
LPECreateCommand baCommand_6("test-validate.claimsgasix",pw,&RID, &tech, &ns, &admin, &billing);
|
|
LPECreateResponse baResponse_6;
|
|
|
|
thisTest = Transaction(&baCommand_6, &baResponse_6);
|
|
manager->execute(thisTest);
|
|
|
|
theseLogs->logN(1,"End OTE Basic Access Tests.",cmd++);
|
|
|
|
sess->close();
|
|
manager->shutdown();
|
|
|
|
}
|
|
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(2,"General Exception during OTE B (%s).",op.c_str());
|
|
}
|
|
|
|
}// debug while
|
|
}
|
|
|
|
void ausRegEPPTK::doOTEP()
|
|
{
|
|
int hours,hoops;
|
|
string op("newInstance");
|
|
|
|
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
|
|
|
|
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();
|
|
sess->open();
|
|
|
|
for (hours=0;hours < 24;hours++) {
|
|
// Spawn the keep alive thread.
|
|
theseLogs->logN(1,"AC Production Hour %d.",hours);
|
|
|
|
// if thisEPPServer(mdStdDevIdx).vendor == "Donuts"
|
|
for (hoops=0;hoops<7;hoops++) {
|
|
sess->writeXML(TEST_SE);
|
|
sess->read();
|
|
sleep(857);
|
|
}
|
|
|
|
}
|
|
sess->close();
|
|
manager->shutdown();
|
|
|
|
}
|
|
catch (EPPException& e)
|
|
{ const char *eMsg = e.getMessage().c_str();
|
|
const char *opNow = op.c_str();
|
|
theseLogs->logN(2,"EPP Exception in Production (%s): %s .",opNow,eMsg);
|
|
throw e;
|
|
}
|
|
catch (...)
|
|
{
|
|
theseLogs->logN(2,"General Exception Production (%s).",op.c_str());
|
|
}
|
|
}
|