DRDE/AusRegCliever/server/mdAusReg.cpp

126 lines
3.7 KiB
C++
Raw Normal View History

2014-01-11 00:58:45 +00:00
#define MD_AUSREG
#include "cliever-md.h"
2014-01-13 03:41:09 +00:00
#include "session/SessionFactory.hpp"
#include "session/SessionManagerProperties.hpp"
#include "common/SystemProperties.hpp"
#include "session/Session.hpp"
#include "session/StatsManager.hpp"
2014-01-07 17:59:27 +00:00
2014-01-11 00:58:45 +00:00
using namespace std;
static TestEnvironment props;
2014-01-07 17:59:27 +00:00
2014-01-13 03:41:09 +00:00
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>";
2014-01-11 00:58:45 +00:00
// static void testExecuteParallelTransactions() throw (EPPException);
bool ausRegEPPTK::didInit(const std::string propertiesFilePath) {
2014-01-07 17:59:27 +00:00
2014-01-10 20:05:42 +00:00
bool did=false;
2014-01-07 17:59:27 +00:00
2014-01-10 20:05:42 +00:00
try {
scenario( tkScenario );
did = true;
}
catch(std::exception &e) {
2014-01-10 22:01:44 +00:00
theseLogs->logN(2,"Scenario %d TK Exception: %s .",tkScenario,e.what());
2014-01-10 20:05:42 +00:00
}
2014-01-10 22:01:44 +00:00
return did;
2014-01-07 17:59:27 +00:00
}
2014-01-11 00:58:45 +00:00
void ausRegEPPTK::doOTEA()
{
2014-01-13 23:19:10 +00:00
int hours,hoops;
2014-01-11 00:58:45 +00:00
string op("newInstance");
2014-01-11 03:01:32 +00:00
if (!daysRunning)
2014-01-11 00:58:45 +00:00
scenario(tkScenario);
try {
Timer::setTime("20070101.010101");
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
2014-01-13 03:41:09 +00:00
auto_ptr<Session> sess(SessionFactory::newInstance(&props));
2014-01-11 00:58:45 +00:00
op = "startup";
manager->startup();
op = "run (keep-alive)";
manager->run();
2014-01-13 23:19:10 +00:00
sess->open();
2014-01-13 03:41:09 +00:00
2014-01-13 23:19:10 +00:00
for (hours=0;hours < 24;hours++) {
2014-01-11 00:58:45 +00:00
// Spawn the keep alive thread.
2014-01-13 23:19:10 +00:00
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);
}
2014-01-13 03:41:09 +00:00
2014-01-11 00:58:45 +00:00
}
2014-01-13 03:41:09 +00:00
sess->close();
2014-01-11 00:58:45 +00:00
manager->shutdown();
2014-01-11 03:01:32 +00:00
2014-01-11 00:58:45 +00:00
}
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());
}
2014-01-13 23:19:10 +00:00
}
2014-01-16 04:42:18 +00:00
void ausRegEPPTK::doOTEB()
{
#define N_OTE_B
int cmd=0;
2014-01-13 23:19:10 +00:00
string op("newInstance");
if (!daysRunning)
scenario(tkScenario);
try {
Timer::setTime("20070101.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();
2014-01-16 04:42:18 +00:00
theseLogs->logN(1,"OTE Basic Access Tests.");
theseLogs->logN(1,"OTE Basic Access Tests (%d).",cmd++);
sess->writeXML(TEST_SE);
sess->read();
theseLogs->logN(1,"Begin Actual Tests.");
sleep(2);
theseLogs->logN(1,"(%d) Conventional check of thoughtcrime.biz",cmd++);
theseLogs->logN(1,"(%d) LPE Check of test-validate.claimsgasix",cmd++);
theseLogs->logN(1,"(%d) Register <registrar>.ote using OTE Account %d.",cmd++);
theseLogs->logN(1,"(%d) Transfer <register>.ote to OTE Account %d.",cmd++);
theseLogs->logN(1,"(%d) Sunrise create with ICANN SMD test files.",cmd++);
theseLogs->logN(1,"End OTE Basic Access Tests.",cmd++);
2014-01-13 23:19:10 +00:00
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());
}
2014-01-11 00:58:45 +00:00
}