#include "common/init.hpp" #include "common/Test.hpp" #include "session/Timer.hpp" #include "se/CLTRID.hpp" #include "se/ContactCheckCommand.hpp" #include "OTE/OteLPECreateCommand.hpp" using namespace std; void doWork() { init("./etc/toolkit2.conf"); const string registrantName = "AusRegistry"; const string registrantID = "01241326211"; const string registrantIDType = "Trade License"; const string eligibilityType = "Trade License (IT)"; const int policyReason = 1; const string eligibilityName = "Blah"; const string eligibilityID = "1231239523"; const string eligibilityIDType = "Trademark"; /** * Test that the XML string generated for a minimal create domain command * matches the expected XML for an EPP create domain command with those * parameters. */ { Timer::setTime("20140101.010101"); CLTRID::setClID("ACTKUTST"); vector techIds; techIds.push_back("JTKCON2"); string registrant("JTKCON"); OteLPECreateCommand cmd("ACTKUTST.co.ae", "jtkUT3st", ®istrant, &techIds, eligibilityType, policyReason, registrantName); const string xml(cmd.toXML()); ASSERT_EQ(xml, "ACTKUTST.co.aeJTKCONJTKCON2jtkUT3stAusRegistryTrade License (IT)1ACTKUTST.20140101.010101.0"); } /** * Test that the XML string generated for a sample create domain command * specified with all available parameters matches the expected XML for * an EPP create domain command with those parameters. * */ { Timer::setTime("20140101.010101"); CLTRID::setClID("ACTKUTST"); vector techIds; techIds.push_back("JTKCON2"); vector adminContacts; adminContacts.push_back("JTKCON"); adminContacts.push_back("JTKCON2"); string registrant("JTKCON"); vector nameServers; nameServers.push_back("ns1.ausregistry.net"); nameServers.push_back("ns2.ausregistry.net"); Period period(48, PeriodUnit::MONTHS()); OteLPECreateCommand cmd( "ACTKUTST.co.ae", "jtkUT3st", ®istrant, &techIds, &adminContacts, NULL, &nameServers, &period, eligibilityType, policyReason, registrantName, ®istrantID, ®istrantIDType, &eligibilityName, &eligibilityID, &eligibilityIDType); const string xml(cmd.toXML()); ASSERT_EQ(xml, "ACTKUTST.co.ae48ns1.ausregistry.netns2.ausregistry.netJTKCONJTKCONJTKCON2JTKCON2jtkUT3stAusRegistry01241326211Trade License (IT)Blah12312395231ACTKUTST.20140101.010101.0"); } } int main(int argc, char* argv[]) { TEST_run(doWork); return TEST_errorCount(); }