#include "se/ContactCheckCommand.hpp" #include "se/AuDomainCreateCommand.hpp" #include "se/CLTRID.hpp" #include "session/Timer.hpp" #include "common/init.hpp" #include "common/Test.hpp" using namespace std; void doWork() { init("etc/toolkit2.conf"); const string registrantName = "AusRegistry"; const string registrantID = "01241326211"; const string registrantIDType = "ACN"; const string eligibilityType = "Company"; const int policyReason = 1; const string eligibilityName = "Blah"; const string eligibilityID = "1231239523"; const string eligibilityIDType = "OTHER"; /** * 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("20070101.010101"); CLTRID::setClID("JTKUTEST"); vector techIds; techIds.push_back("JTKCON2"); string registrant("JTKCON"); AuDomainCreateCommand cmd("jtkutest.com.au", "jtkUT3st", ®istrant, &techIds, eligibilityType, policyReason, registrantName); const string xml(cmd.toXML()); ASSERT_EQ(xml, "jtkutest.com.auJTKCONJTKCON2jtkUT3stAusRegistryCompany1JTKUTEST.20070101.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("20070101.010101"); CLTRID::setClID("JTKUTEST"); 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"); AuDomainCreateCommand cmd( "jtkutest.com.au", "jtkUT3st", ®istrant, &techIds, &adminContacts, NULL, &nameServers, eligibilityType, policyReason, registrantName, ®istrantID, ®istrantIDType, &eligibilityName, &eligibilityID, &eligibilityIDType); const string xml(cmd.toXML()); ASSERT_EQ(xml, "jtkutest.com.auns1.ausregistry.netns2.ausregistry.netJTKCONJTKCONJTKCON2JTKCON2jtkUT3stAusRegistry01241326211CompanyBlah12312395231JTKUTEST.20070101.010101.0"); } } int main(int argc, char* argv[]) { TEST_run(doWork); return TEST_errorCount(); }