#include "se/ContactCheckResponse.hpp" #include "se/EnumDomainInfoResponse.hpp" #include "xml/XMLParser.hpp" #include "session/Timer.hpp" #include "common/Test.hpp" #include "common/init.hpp" #include "se/EPPDateFormatter.hpp" using namespace std; void doWork() { init("etc/toolkit2.conf"); const string xml = "Command completed successfully3.8.0.0.6.9.2.3.6.1.4.4.e164.arpaEXAMPLE1-REPjd1234sh8013sh8013ns1.example.comns2.example.comns1.example.comns2.example.comClientXClientY1999-04-03T22:00:00.0ZClientX1999-12-03T09:00:00.0Z2005-04-03T22:00:00.0Z2000-04-08T09:00:00.0Z2fooBAR10100uE2U+sip\"!^.*$!sip:info@example.com!\"10102uE2U+msg\"!^.*$!mailto:info@example.com!\"ABC-1234554322-XYZ"; EnumDomainInfoResponse response; XMLParser parser; auto_ptr doc(parser.parse(xml)); try { response.fromXML(doc.get()); } catch (ParsingException& pe) { cerr << pe.getMessage() << endl; exit(1); } { vector naptrs(response.getNAPTRs()); ASSERT_EQ(2, naptrs.size()); if (naptrs.size() != 2) exit(1); ASSERT_EQ(10, naptrs[0].getOrder()); ASSERT_EQ(100, naptrs[0].getPreference()); ASSERT_EQ("u", naptrs[0].getFlags()); ASSERT_EQ("E2U+sip", naptrs[0].getService()); ASSERT_EQ("\"!^.*$!sip:info@example.com!\"", naptrs[0].getRegex()); ASSERT_EQ("", naptrs[0].getReplacement()); ASSERT_EQ(10, naptrs[1].getOrder()); ASSERT_EQ(102, naptrs[1].getPreference()); ASSERT_EQ("u", naptrs[1].getFlags()); ASSERT_EQ("E2U+msg", naptrs[1].getService()); ASSERT_EQ("\"!^.*$!mailto:info@example.com!\"", naptrs[1].getRegex()); ASSERT_EQ("", naptrs[1].getReplacement()); } { vector statuses = response.getStatuses(); ASSERT_EQ(statuses.size(), 1); ASSERT_EQ(statuses[0].toString(), statuses[0].toString()); ASSERT_EQ("3.8.0.0.6.9.2.3.6.1.4.4.e164.arpa", response.getName()); ASSERT_EQ("2fooBAR", response.getPW()); ASSERT_EQ("jd1234", response.getRegistrantID()); vector contacts(response.getTechContacts()); ASSERT_EQ(1, contacts.size()); ASSERT_EQ("sh8013", contacts[0]); vector contacts2(response.getAdminContacts()); ASSERT_EQ(1, contacts2.size()); ASSERT_EQ("sh8013", contacts2[0]); const vector& contacts3(response.getBillingContacts()); ASSERT_EQ(contacts3.size(), 0); vector ns(response.getNameservers()); ASSERT_EQ(2, ns.size()); ASSERT_EQ("ns1.example.com", ns[0]); ASSERT_EQ("ns2.example.com", ns[1]); ASSERT_EQ(2, response.getSubordinateHosts().size()); ASSERT_EQ("ns1.example.com", response.getSubordinateHosts()[0]); ASSERT_EQ("ns2.example.com", response.getSubordinateHosts()[1]); ASSERT_EQ("EXAMPLE1-REP", response.getROID()); #if 0 ASSERT_EQ( EPPDateFormatter.fromXSDateTime("1999-04-03T22:00:00.0Z"), response.getCreateDate()); ASSERT_EQ( EPPDateFormatter.fromXSDateTime("1999-12-03T09:00:00.0Z"), response.getUpdateDate()); #endif ASSERT_EQ("ClientY", response.getCreateClient()); ASSERT_EQ("ClientX", response.getUpdateClient()); ASSERT_EQ("ClientX", response.getSponsorClient()); } } int main(int argc, char* argv[]) { TEST_run(doWork); return TEST_errorCount(); }