2014-01-06 19:19:17 +00:00
|
|
|
#include "xml/XMLParser.hpp"
|
|
|
|
#include "common/init.hpp"
|
|
|
|
#include "common/Test.hpp"
|
|
|
|
#include "session/Timer.hpp"
|
|
|
|
#include "se/DomainKVCommandExtension.hpp"
|
|
|
|
#include "se/DomainCreateCommand.hpp"
|
|
|
|
#include "se/DomainUpdateCommand.hpp"
|
|
|
|
#include "se/StandardCommandType.hpp"
|
|
|
|
#include "se/CLTRID.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
void addSampleItemsToExtension(DomainKVCommandExtension &extension, const string &listName);
|
|
|
|
|
|
|
|
const static string registrantName = "AusRegistry";
|
|
|
|
const static string eligibilityType = "Trademark";
|
|
|
|
const static string policyReason = "1";
|
|
|
|
|
|
|
|
void testUpdateSingleKVList()
|
|
|
|
{
|
2014-01-18 20:35:18 +00:00
|
|
|
Timer::setTime("20140101.010101");
|
2014-01-21 23:01:41 +00:00
|
|
|
CLTRID::setClID("ACTKUTST");
|
2014-01-06 19:19:17 +00:00
|
|
|
|
|
|
|
DomainKVCommandExtension extension(StandardCommandType::UPDATE());
|
|
|
|
addSampleItemsToExtension(extension, "ae");
|
|
|
|
|
2014-01-21 23:01:41 +00:00
|
|
|
DomainUpdateCommand updateCommand("ACTKUTST.com.ae");
|
2014-01-06 19:19:17 +00:00
|
|
|
|
|
|
|
updateCommand.appendExtension(extension);
|
|
|
|
|
|
|
|
const string xml = updateCommand.toXML();
|
|
|
|
ASSERT_EQ(xml,
|
2014-01-25 17:23:41 +00:00
|
|
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><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\"><command><update><update xmlns=\"urn:ietf:params:xml:ns:domain-1.0\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd\"><name>ACTKUTST.com.ae</name></update></update><extension><update xmlns=\"urn:X-ac:params:xml:ns:kv-1.0\"><kvlist name=\"ae\"><item key=\"eligibilityType\">Trademark</item><item key=\"policyReason\">1</item><item key=\"registrantName\">AusRegistry</item></kvlist></update></extension><clTRID>ACTKUTST.20140101.010101.0</clTRID></command></epp>"
|
2014-01-06 19:19:17 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void testCreateSingleKVList()
|
|
|
|
{
|
2014-01-18 20:35:18 +00:00
|
|
|
Timer::setTime("20140101.010101");
|
2014-01-21 23:01:41 +00:00
|
|
|
CLTRID::setClID("ACTKUTST");
|
2014-01-06 19:19:17 +00:00
|
|
|
|
|
|
|
DomainKVCommandExtension extension(StandardCommandType::CREATE());
|
|
|
|
addSampleItemsToExtension(extension, "ae");
|
|
|
|
|
|
|
|
string registrant("JTKCON");
|
2014-01-21 23:01:41 +00:00
|
|
|
DomainCreateCommand createCommand("ACTKUTST.com.ae", "jtkUT3st", ®istrant);
|
2014-01-06 19:19:17 +00:00
|
|
|
|
|
|
|
createCommand.appendExtension(extension);
|
|
|
|
|
|
|
|
const string xml = createCommand.toXML();
|
|
|
|
ASSERT_EQ(xml,
|
2014-01-25 17:23:41 +00:00
|
|
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><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\"><command><create><create xmlns=\"urn:ietf:params:xml:ns:domain-1.0\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd\"><name>ACTKUTST.com.ae</name><registrant>JTKCON</registrant><authInfo><pw>jtkUT3st</pw></authInfo></create></create><extension><create xmlns=\"urn:X-ac:params:xml:ns:kv-1.0\"><kvlist name=\"ae\"><item key=\"eligibilityType\">Trademark</item><item key=\"policyReason\">1</item><item key=\"registrantName\">AusRegistry</item></kvlist></create></extension><clTRID>ACTKUTST.20140101.010101.0</clTRID></command></epp>"
|
2014-01-06 19:19:17 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void testMultipleKVList()
|
|
|
|
{
|
2014-01-18 20:35:18 +00:00
|
|
|
Timer::setTime("20140101.010101");
|
2014-01-21 23:01:41 +00:00
|
|
|
CLTRID::setClID("ACTKUTST");
|
2014-01-06 19:19:17 +00:00
|
|
|
|
|
|
|
DomainKVCommandExtension extension(StandardCommandType::CREATE());
|
|
|
|
addSampleItemsToExtension(extension, "ae");
|
|
|
|
addSampleItemsToExtension(extension, "au");
|
|
|
|
|
|
|
|
string registrant("JTKCON");
|
2014-01-21 23:01:41 +00:00
|
|
|
DomainCreateCommand createCommand("ACTKUTST.com.ae", "jtkUT3st", ®istrant);
|
2014-01-06 19:19:17 +00:00
|
|
|
|
|
|
|
createCommand.appendExtension(extension);
|
|
|
|
|
|
|
|
const string xml = createCommand.toXML();
|
|
|
|
ASSERT_EQ(xml,
|
2014-01-25 17:23:41 +00:00
|
|
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><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\"><command><create><create xmlns=\"urn:ietf:params:xml:ns:domain-1.0\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd\"><name>ACTKUTST.com.ae</name><registrant>JTKCON</registrant><authInfo><pw>jtkUT3st</pw></authInfo></create></create><extension><create xmlns=\"urn:X-ac:params:xml:ns:kv-1.0\"><kvlist name=\"ae\"><item key=\"eligibilityType\">Trademark</item><item key=\"policyReason\">1</item><item key=\"registrantName\">AusRegistry</item></kvlist><kvlist name=\"au\"><item key=\"eligibilityType\">Trademark</item><item key=\"policyReason\">1</item><item key=\"registrantName\">AusRegistry</item></kvlist></create></extension><clTRID>ACTKUTST.20140101.010101.0</clTRID></command></epp>"
|
2014-01-06 19:19:17 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void addSampleItemsToExtension(DomainKVCommandExtension &extension, const string &listName)
|
|
|
|
{
|
|
|
|
extension.addItem(listName, "eligibilityType", eligibilityType);
|
|
|
|
extension.addItem(listName, "policyReason", policyReason);
|
|
|
|
extension.addItem(listName, "registrantName", registrantName);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2014-01-16 20:28:52 +00:00
|
|
|
init("./etc/toolkit2.conf");
|
2014-01-06 19:19:17 +00:00
|
|
|
TEST_run(testUpdateSingleKVList);
|
|
|
|
TEST_run(testCreateSingleKVList);
|
|
|
|
TEST_run(testMultipleKVList);
|
|
|
|
|
|
|
|
return TEST_errorCount();
|
|
|
|
}
|