This commit is contained in:
Ren RenJuan 2014-01-17 01:46:48 +00:00
parent 565b85ca23
commit 318ea42bba
41 changed files with 97 additions and 96 deletions

View File

@ -1,8 +1,8 @@
################################################## ##################################################
# Makefile for building lib and main test routine# # Makefile for building lib and main test routine#
################################################## ##################################################
#LOCATION=DEBIAN_7 LOCATION=DEBIAN_7
LOCATION=DEBIAN_6 #LOCATION=DEBIAN_6
#LOCATION=OSX_10_8 #LOCATION=OSX_10_8
SYSTEM = $(shell uname -s) SYSTEM = $(shell uname -s)
@ -115,7 +115,7 @@ $(BUILD_OBJ_DIR)/%: $(BUILD_OBJ_DIR)/%.o
# The toolkit raises the c++ "static initialization fiasco" situation. # The toolkit raises the c++ "static initialization fiasco" situation.
# #
ARTKOBJS= build/XMLGregorianCalendar.o build/XMLParser.o build/XMLWriter.o build/ACSession.o build/DomainAddRem.o build/EnumDomainInfoResponse.o build/log.o build/PostalInfoType.o build/SessionManagerPropertiesImpl.o \ ARTKOBJS= build/XMLGregorianCalendar.o build/XMLParser.o build/XMLWriter.o build/ACSession.o build/DomainAddRem.o build/EnumDomainInfoResponse.o build/log.o build/PostalInfoType.o build/SessionManagerPropertiesImpl.o \
build/RegistrantObjectType.o / build/RegistrantObjectType.o \
build/AddRemType.o build/DomainCheckResponse.o build/EnumDomainUpdateCommand.o build/LPECheckResponse.o build/Properties.o build/SessionPoolImpl.o \ build/AddRemType.o build/DomainCheckResponse.o build/EnumDomainUpdateCommand.o build/LPECheckResponse.o build/Properties.o build/SessionPoolImpl.o \
build/boolean.o build/DomainCreateCommand.o build/EnumType.o build/LPECreateCommand.o build/ProtocolExtensionCommand.o build/SSLException.o \ build/boolean.o build/DomainCreateCommand.o build/EnumType.o build/LPECreateCommand.o build/ProtocolExtensionCommand.o build/SSLException.o \
build/CertificateUserMismatchException.o build/DomainCreateResponse.o build/EPPDateFormatter.o build/LPECreateResponse.o build/ReceiveSE.o build/StandardCommandType.o \ build/CertificateUserMismatchException.o build/DomainCreateResponse.o build/EPPDateFormatter.o build/LPECreateResponse.o build/ReceiveSE.o build/StandardCommandType.o \

View File

@ -1,8 +1,8 @@
#include "common/init.hpp" #include "common/init.hpp"
#include "common/Test.hpp" #include "common/Test.hpp"
#include "se/CLTRID.hpp" #include "se/CLTRID.hpp"
#include "OTE/LPECheckCommand.hpp"
#include "session/Timer.hpp" #include "session/Timer.hpp"
#include "OTE/LPECheckCommand.hpp"
#include <iostream> #include <iostream>

View File

@ -1,6 +1,6 @@
#include "OTE/LPECheckResponse.hpp"
#include "common/StringUtils.hpp" #include "common/StringUtils.hpp"
#include "se/StandardObjectType.hpp" #include "se/StandardObjectType.hpp"
#include "OTE/LPECheckResponse.hpp"
const std::string& LPECheckResponse::DOM_CHKDATA_COUNT_EXPR() const std::string& LPECheckResponse::DOM_CHKDATA_COUNT_EXPR()
{ {

View File

@ -1,10 +1,10 @@
#include "OTE/LPECheckResponse.hpp"
#include "session/TestEnvironment.hpp" #include "session/TestEnvironment.hpp"
#include "xml/XMLParser.hpp" #include "xml/XMLParser.hpp"
#include "xml/XMLDocument.hpp" #include "xml/XMLDocument.hpp"
#include "common/init.hpp" #include "common/init.hpp"
#include "common/Test.hpp" #include "common/Test.hpp"
#include "OTE/LPECheckResponse.hpp"
#include <memory> #include <memory>

View File

@ -1,6 +1,6 @@
#include "OTE/LPECreateCommand.hpp"
#include "se/StandardObjectType.hpp" #include "se/StandardObjectType.hpp"
#include "xml/XMLHelper.hpp" #include "xml/XMLHelper.hpp"
#include "OTE/LPECreateCommand.hpp"
LPECreateCommand::LPECreateCommand (const std::string& name, LPECreateCommand::LPECreateCommand (const std::string& name,

View File

@ -1,7 +1,7 @@
#include "OTE/LPECreateResponse.hpp"
#include "se/StandardObjectType.hpp" #include "se/StandardObjectType.hpp"
#include "se/EPPDateFormatter.hpp" #include "se/EPPDateFormatter.hpp"
#include "common/StringUtils.hpp" #include "common/StringUtils.hpp"
#include "OTE/LPECreateResponse.hpp"
const std::string LPECreateResponse::DOM_CR_DATE_EXPR const std::string LPECreateResponse::DOM_CR_DATE_EXPR
(LPECreateResponse::exprReplace (LPECreateResponse::exprReplace

View File

@ -1,7 +1,8 @@
#include "OTE/OteDomainModifyRegistrantCommand.hpp"
#include "common/ErrorPkg.hpp" #include "common/ErrorPkg.hpp"
#include "OTE/OteExtension.hpp"
#include "xml/XMLHelper.hpp" #include "xml/XMLHelper.hpp"
#include "OTE/OteExtension.hpp"
#include "OTE/OteDomainModifyRegistrantCommand.hpp"
namespace { namespace {
OteExtension& oteExtension() { OteExtension& oteExtension() {

View File

@ -1,12 +1,12 @@
#include "OTE/OteDomainTransferRegistrantCommand.hpp"
#include "se/XMLGregorianCalendar.hpp" #include "se/XMLGregorianCalendar.hpp"
#include "se/CommandType.hpp"
#include "common/ErrorPkg.hpp"
#include "se/Period.hpp"
#include "se/RegistrantTransferCommandType.hpp"
#include "OTE/OteExtension.hpp" #include "OTE/OteExtension.hpp"
#include "OTE/OteDomainObjectType.hpp" #include "OTE/OteDomainObjectType.hpp"
#include "se/RegistrantTransferCommandType.hpp" #include "OTE/OteDomainTransferRegistrantCommand.hpp"
#include "se/CommandType.hpp"
#include "se/Period.hpp"
#include "common/ErrorPkg.hpp"
#include "se/EPPDateFormatter.hpp" #include "se/EPPDateFormatter.hpp"

View File

@ -1,7 +1,7 @@
#include "OTE/OteDomainTransferRegistrantResponse.hpp"
#include "OTE/OteDomainObjectType.hpp"
#include "se/RegistrantTransferCommandType.hpp" #include "se/RegistrantTransferCommandType.hpp"
#include "se/EPPDateFormatter.hpp" #include "se/EPPDateFormatter.hpp"
#include "OTE/OteDomainObjectType.hpp"
#include "OTE/OteDomainTransferRegistrantResponse.hpp"
namespace { namespace {
const RegistrantTransferCommandType rtrnType; const RegistrantTransferCommandType rtrnType;

View File

@ -1,7 +1,7 @@
#include "OTE/OteLPECreateCommand.hpp"
#include "xml/XMLHelper.hpp" #include "xml/XMLHelper.hpp"
#include "OTE/OteExtension.hpp"
#include "common/ErrorPkg.hpp" #include "common/ErrorPkg.hpp"
#include "OTE/OteExtension.hpp"
#include "OTE/OteLPECreateCommand.hpp"
namespace { namespace {
Extension& oteExtension() { Extension& oteExtension() {

View File

@ -1,9 +1,9 @@
#include "common/init.hpp" #include "common/init.hpp"
#include "common/Test.hpp" #include "common/Test.hpp"
#include "session/Timer.hpp" #include "session/Timer.hpp"
#include "se/CLTRID.hpp"
#include "se/ContactCheckCommand.hpp" #include "se/ContactCheckCommand.hpp"
#include "OTE/OteLPECreateCommand.hpp" #include "OTE/OteLPECreateCommand.hpp"
#include "se/CLTRID.hpp"
using namespace std; using namespace std;

View File

@ -24,7 +24,7 @@ namespace {
AeDomainTransferRegistrantCommand::AeDomainTransferRegistrantCommand ( AeDomainTransferRegistrantCommand::AeDomainTransferRegistrantCommand (
const std::string& name, const std::string& name,
const XMLGregorianCalendar& curExpDate, constXMLGC::XMLGregorianCalendar& curExpDate,
const std::string& eligibilityType, const std::string& eligibilityType,
int policyReason, int policyReason,
const std::string& registrantName, const std::string& registrantName,

View File

@ -31,7 +31,7 @@ void AeDomainTransferRegistrantResponse::fromXML(XMLDocument* xmlDoc) throw (Par
name = xmlDoc->getNodeValue(AEDOM_NAME_EXPR); name = xmlDoc->getNodeValue(AEDOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue(AEDOM_EX_DATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue(AEDOM_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>( exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(
EPPDateFormatter::fromXSDateTime(exDateStr)); EPPDateFormatter::fromXSDateTime(exDateStr));
} }

View File

@ -27,7 +27,7 @@ namespace {
ArDomainUnrenewCommand::ArDomainUnrenewCommand( ArDomainUnrenewCommand::ArDomainUnrenewCommand(
const std::string &name, const std::string &name,
const XMLGregorianCalendar& exDate) : ProtocolExtensionCommand( constXMLGC::XMLGregorianCalendar& exDate) : ProtocolExtensionCommand(
&unrenewCmdType, &ardomType, name, arExtension()) &unrenewCmdType, &ardomType, name, arExtension())
{ {
std::string exDateStr = EPPDateFormatter::toXSDate(exDate); std::string exDateStr = EPPDateFormatter::toXSDate(exDate);

View File

@ -31,7 +31,7 @@ void ArDomainUnrenewResponse::fromXML(XMLDocument* xmlDoc) throw (ParsingExcepti
name = xmlDoc->getNodeValue(ARDOM_NAME_EXPR); name = xmlDoc->getNodeValue(ARDOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue(ARDOM_EX_DATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue(ARDOM_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>( exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(
EPPDateFormatter::fromXSDateTime(exDateStr)); EPPDateFormatter::fromXSDateTime(exDateStr));
} }

View File

@ -22,7 +22,7 @@ void doWork()
response1.fromXML(doc.get()); response1.fromXML(doc.get());
{ {
ASSERT_EQ(response1.getName(), "example.com"); ASSERT_EQ(response1.getName(), "example.com");
const XMLGregorianCalendar *exDate = response1.getExpiryDate(); constXMLGC::XMLGregorianCalendar *exDate = response1.getExpiryDate();
string res = EPPDateFormatter::toXSDateTime(*exDate); string res = EPPDateFormatter::toXSDateTime(*exDate);
ASSERT_EQ(res, "2009-04-03T22:00:00.0Z"); ASSERT_EQ(res, "2009-04-03T22:00:00.0Z");
const vector<Result>& results(response1.getResults()); const vector<Result>& results(response1.getResults());
@ -36,7 +36,7 @@ void doWork()
response2.fromXML(doc2.get()); response2.fromXML(doc2.get());
{ {
ASSERT_EQ(response2.getName(), "example.com"); ASSERT_EQ(response2.getName(), "example.com");
const XMLGregorianCalendar *exDate = response2.getExpiryDate(); constXMLGC::XMLGregorianCalendar *exDate = response2.getExpiryDate();
ASSERT_NULL(exDate); ASSERT_NULL(exDate);
const vector<Result>& results(response2.getResults()); const vector<Result>& results(response2.getResults());
ASSERT_EQ(response2.getCLTRID(), "ABC-12345"); ASSERT_EQ(response2.getCLTRID(), "ABC-12345");

View File

@ -24,7 +24,7 @@ namespace {
AuDomainTransferRegistrantCommand::AuDomainTransferRegistrantCommand ( AuDomainTransferRegistrantCommand::AuDomainTransferRegistrantCommand (
const std::string& name, const std::string& name,
const XMLGregorianCalendar& curExpDate, constXMLGC::XMLGregorianCalendar& curExpDate,
const std::string& eligibilityType, const std::string& eligibilityType,
int policyReason, int policyReason,
const std::string& registrantName, const std::string& registrantName,

View File

@ -22,7 +22,7 @@ void doWork()
const string eligibilityName = "Blah"; const string eligibilityName = "Blah";
const string eligibilityID = "1231239523"; const string eligibilityID = "1231239523";
const string eligibilityIDType = "OTHER"; const string eligibilityIDType = "OTHER";
auto_ptr<XMLGregorianCalendar> curExpDate(EPPDateFormatter::fromXSDateTime("2014-01-01T01:01:01.0Z")); auto_ptr<XMLGC::XMLGregorianCalendar> curExpDate(EPPDateFormatter::fromXSDateTime("2014-01-01T01:01:01.0Z"));
{ {
Timer::setTime("20070101.010101"); Timer::setTime("20070101.010101");

View File

@ -31,7 +31,7 @@ void AuDomainTransferRegistrantResponse::fromXML(XMLDocument* xmlDoc) throw (Par
name = xmlDoc->getNodeValue(AUDOM_NAME_EXPR); name = xmlDoc->getNodeValue(AUDOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue(AUDOM_EX_DATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue(AUDOM_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>( exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(
EPPDateFormatter::fromXSDateTime(exDateStr)); EPPDateFormatter::fromXSDateTime(exDateStr));
} }

View File

@ -20,7 +20,7 @@ void doWork()
response.fromXML(doc.get()); response.fromXML(doc.get());
{ {
ASSERT_EQ(response.getName(), "example.com"); ASSERT_EQ(response.getName(), "example.com");
const XMLGregorianCalendar *exDate = response.getExpiryDate(); constXMLGC::XMLGregorianCalendar *exDate = response.getExpiryDate();
string res = EPPDateFormatter::toXSDateTime(*exDate); string res = EPPDateFormatter::toXSDateTime(*exDate);
ASSERT_EQ(res, "2009-04-03T22:00:00.0Z"); ASSERT_EQ(res, "2009-04-03T22:00:00.0Z");
const vector<Result>& results(response.getResults()); const vector<Result>& results(response.getResults());

View File

@ -35,7 +35,7 @@ void CreateResponse::fromXML(XMLDocument *xmlDoc) throw (ParsingException)
try try
{ {
std::string crDateStr = xmlDoc->getNodeValue(crDateExpr()); std::string crDateStr = xmlDoc->getNodeValue(crDateExpr());
crDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(crDateStr)); crDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(crDateStr));
} }
catch (IllegalArgException& iae) catch (IllegalArgException& iae)
{ {

View File

@ -35,7 +35,7 @@ void DomainCreateResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException
{ {
name = xmlDoc->getNodeValue (DOM_NAME_EXPR); name = xmlDoc->getNodeValue (DOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue (DOM_EX_DATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue (DOM_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(exDateStr)); exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(exDateStr));
} }
catch (XPathExpressionException& e) catch (XPathExpressionException& e)
{ {

View File

@ -160,7 +160,7 @@ void DomainInfoResponse::fromXML(XMLDocument *xmlDoc) throw (ParsingException)
name = xmlDoc->getNodeValue(DOM_NAME_EXPR()); name = xmlDoc->getNodeValue(DOM_NAME_EXPR());
pw = xmlDoc->getNodeValue(DOM_PW_EXPR()); pw = xmlDoc->getNodeValue(DOM_PW_EXPR());
registrantID = xmlDoc->getNodeValue (DOM_REGISTRANT_EXPR()); registrantID = xmlDoc->getNodeValue (DOM_REGISTRANT_EXPR());
exDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime
(xmlDoc->getNodeValue (DOM_EX_DATE_EXPR()))); (xmlDoc->getNodeValue (DOM_EX_DATE_EXPR())));
delHosts = xmlDoc->getNodeValues(DOM_NS_EXPR()); delHosts = xmlDoc->getNodeValues(DOM_NS_EXPR());
subHosts = xmlDoc->getNodeValues(DOM_HOST_EXPR()); subHosts = xmlDoc->getNodeValues(DOM_HOST_EXPR());

View File

@ -24,7 +24,7 @@ RegistrantObjectType& registrantObjectType() {
} // anonymous namespace } // anonymous namespace
DomainRegistrantTransferCommand::DomainRegistrantTransferCommand(const std::string& name, DomainRegistrantTransferCommand::DomainRegistrantTransferCommand(const std::string& name,
const XMLGregorianCalendar& curExpDate, constXMLGC::XMLGregorianCalendar& curExpDate,
const std::string& kvListName, const std::string& kvListName,
const std::string& explanation, const std::string& explanation,
const Period* period) : const Period* period) :

View File

@ -16,7 +16,7 @@ const static std::string policyReason = "1";
const static std::string eligibilityName = "Blah"; const static std::string eligibilityName = "Blah";
const static std::string eligibilityIDValue = "1231239523"; const static std::string eligibilityIDValue = "1231239523";
const static std::string eligibilityIDType = "Trademark"; const static std::string eligibilityIDType = "Trademark";
const auto_ptr<XMLGregorianCalendar> curExpDate(EPPDateFormatter::fromXSDateTime("2014-01-01T01:01:01.0Z")); const auto_ptr<XMLGC::XMLGregorianCalendar> curExpDate(EPPDateFormatter::fromXSDateTime("2014-01-01T01:01:01.0Z"));
const static std::string kvListName = "ae"; const static std::string kvListName = "ae";
void addSampleKVItems(DomainRegistrantTransferCommand *command); void addSampleKVItems(DomainRegistrantTransferCommand *command);

View File

@ -31,7 +31,7 @@ void DomainRegistrantTransferResponse::fromXML(XMLDocument* xmlDoc) throw (Parsi
name = xmlDoc->getNodeValue(REGISTRANT_NAME_EXPR); name = xmlDoc->getNodeValue(REGISTRANT_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue(REGISTRANT_EX_DATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue(REGISTRANT_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>( exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(
EPPDateFormatter::fromXSDateTime(exDateStr)); EPPDateFormatter::fromXSDateTime(exDateStr));
} }

View File

@ -20,7 +20,7 @@ void doWork()
response.fromXML(doc.get()); response.fromXML(doc.get());
{ {
ASSERT_EQ(response.getName(), "example.com"); ASSERT_EQ(response.getName(), "example.com");
const XMLGregorianCalendar *exDate = response.getExpiryDate(); constXMLGC::XMLGregorianCalendar *exDate = response.getExpiryDate();
string res = EPPDateFormatter::toXSDateTime(*exDate); string res = EPPDateFormatter::toXSDateTime(*exDate);
ASSERT_EQ(res, "2009-04-03T22:00:00.0Z"); ASSERT_EQ(res, "2009-04-03T22:00:00.0Z");
const vector<Result>& results(response.getResults()); const vector<Result>& results(response.getResults());

View File

@ -6,7 +6,7 @@
#include "se/EPPDateFormatter.hpp" #include "se/EPPDateFormatter.hpp"
DomainRenewCommand::DomainRenewCommand (const std::string &name, DomainRenewCommand::DomainRenewCommand (const std::string &name,
const XMLGregorianCalendar &exDate) constXMLGC::XMLGregorianCalendar &exDate)
: ObjectCommand(StandardCommandType::RENEW(), : ObjectCommand(StandardCommandType::RENEW(),
StandardObjectType::DOMAIN(), StandardObjectType::DOMAIN(),
name) name)
@ -16,7 +16,7 @@ DomainRenewCommand::DomainRenewCommand (const std::string &name,
DomainRenewCommand::DomainRenewCommand (const std::string &name, DomainRenewCommand::DomainRenewCommand (const std::string &name,
const XMLGregorianCalendar &exDate, constXMLGC::XMLGregorianCalendar &exDate,
const Period &period) const Period &period)
: ObjectCommand(StandardCommandType::RENEW(), : ObjectCommand(StandardCommandType::RENEW(),
StandardObjectType::DOMAIN(), StandardObjectType::DOMAIN(),
@ -29,7 +29,7 @@ DomainRenewCommand::DomainRenewCommand (const std::string &name,
void DomainRenewCommand::Init (const std::string &name, void DomainRenewCommand::Init (const std::string &name,
const XMLGregorianCalendar &exDate) constXMLGC::XMLGregorianCalendar &exDate)
{ {
XMLHelper::setTextContent XMLHelper::setTextContent
(xmlWriter->appendChild (objElement, "curExpDate"), (xmlWriter->appendChild (objElement, "curExpDate"),

View File

@ -26,7 +26,7 @@ void DomainRenewResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
{ {
name = xmlDoc->getNodeValue (DOM_NAME_EXPR); name = xmlDoc->getNodeValue (DOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue (DOM_EX_DATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue (DOM_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>( exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(
EPPDateFormatter::fromXSDateTime(exDateStr)); EPPDateFormatter::fromXSDateTime(exDateStr));
} }
catch (XPathExpressionException& e) catch (XPathExpressionException& e)

View File

@ -48,7 +48,7 @@ void DomainTransferResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingExcepti
name = xmlDoc->getNodeValue(DOM_NAME_EXPR); name = xmlDoc->getNodeValue(DOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue(DOM_EXDATE_EXPR); std::string exDateStr = xmlDoc->getNodeValue(DOM_EXDATE_EXPR);
if (exDateStr.length() > 0) if (exDateStr.length() > 0)
exDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(exDateStr)); exDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(exDateStr));
} }
catch (XPathExpressionException& e) catch (XPathExpressionException& e)
{ {

View File

@ -86,7 +86,7 @@ void testSyncExpiryDateExtension(void)
CLTRID::setClID("JTKUTEST"); CLTRID::setClID("JTKUTEST");
DomainUpdateCommand cmd("jtkutest.com.au"); DomainUpdateCommand cmd("jtkutest.com.au");
XMLGregorianCalendar *newExpiryDate = EPPDateFormatter::fromXSDateTime("2005-04-03T22:00:00.0Z"); XMLGC::XMLGregorianCalendar *newExpiryDate = EPPDateFormatter::fromXSDateTime("2005-04-03T22:00:00.0Z");
DomainUpdateSyncCommandExtension extension(newExpiryDate); DomainUpdateSyncCommandExtension extension(newExpiryDate);
cmd.appendExtension(extension); cmd.appendExtension(extension);

View File

@ -2,12 +2,12 @@
#include "se/XMLGregorianCalendar.hpp" #include "se/XMLGregorianCalendar.hpp"
#include <sstream> #include <sstream>
std::string EPPDateFormatter::toXSDateTime(const XMLGregorianCalendar& date) std::string EPPDateFormatter::toXSDateTime(constXMLGC::XMLGregorianCalendar& date)
{ {
return date.toXMLFormat(); return date.toXMLFormat();
} }
std::string EPPDateFormatter::toXSDate(const XMLGregorianCalendar& date) std::string EPPDateFormatter::toXSDate(constXMLGC::XMLGregorianCalendar& date)
{ {
return date.format("%Y-%M-%D"); return date.format("%Y-%M-%D");
} }
@ -16,7 +16,7 @@ XMLGregorianCalendar* EPPDateFormatter::fromXSDateTime(const std::string &dateTi
{ {
try try
{ {
return new XMLGregorianCalendar(dateTime); return newXMLGC::XMLGregorianCalendar(dateTime);
} }
catch (MalformedDateException& e) catch (MalformedDateException& e)
{ {

View File

@ -55,7 +55,7 @@ void Greeting::fromXML(XMLDocument *xmlDoc) throw (ParsingException)
// debugLogger->info (xmlDoc->toString()); // debugLogger->info (xmlDoc->toString());
svID = xmlDoc->getNodeValue (SVID_EXPR); svID = xmlDoc->getNodeValue (SVID_EXPR);
std::string svDateText = xmlDoc->getNodeValue (SVDATE_EXPR); std::string svDateText = xmlDoc->getNodeValue (SVDATE_EXPR);
svDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(svDateText)); svDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(svDateText));
versions = xmlDoc->getNodeValues(VERSIONS_EXPR); versions = xmlDoc->getNodeValues(VERSIONS_EXPR);
langs = xmlDoc->getNodeValues(LANGS_EXPR); langs = xmlDoc->getNodeValues(LANGS_EXPR);
objURIs = xmlDoc->getNodeValues(OBJ_URIS_EXPR); objURIs = xmlDoc->getNodeValues(OBJ_URIS_EXPR);

View File

@ -38,11 +38,11 @@ void doWork()
{ {
ASSERT_EQ("NS1_EXAMPLE1-REP", response.getROID()); ASSERT_EQ("NS1_EXAMPLE1-REP", response.getROID());
auto_ptr<XMLGregorianCalendar> dt( auto_ptr<XMLGC::XMLGregorianCalendar> dt(
EPPDateFormatter::fromXSDateTime("1999-04-03T22:00:00.0Z")); EPPDateFormatter::fromXSDateTime("1999-04-03T22:00:00.0Z"));
ASSERT_EQ(EPPDateFormatter::toXSDateTime(*dt), "1999-04-03T22:00:00.0Z"); ASSERT_EQ(EPPDateFormatter::toXSDateTime(*dt), "1999-04-03T22:00:00.0Z");
auto_ptr<XMLGregorianCalendar> dt2( auto_ptr<XMLGC::XMLGregorianCalendar> dt2(
EPPDateFormatter::fromXSDateTime("1999-04-03T22:00:00.0Z")); EPPDateFormatter::fromXSDateTime("1999-04-03T22:00:00.0Z"));
ASSERT_EQ(EPPDateFormatter::toXSDateTime(*dt2), "1999-04-03T22:00:00.0Z"); ASSERT_EQ(EPPDateFormatter::toXSDateTime(*dt2), "1999-04-03T22:00:00.0Z");

View File

@ -96,9 +96,9 @@ void InfoResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
std::string upDateStr = xmlDoc->getNodeValue(upDateExpr()); std::string upDateStr = xmlDoc->getNodeValue(upDateExpr());
std::string trDateStr = xmlDoc->getNodeValue(trDateExpr()); std::string trDateStr = xmlDoc->getNodeValue(trDateExpr());
crDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(crDateStr)); crDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(crDateStr));
upDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(upDateStr)); upDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(upDateStr));
trDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(trDateStr)); trDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(trDateStr));
int statusCount = xmlDoc->getNodeCount (statusCountExpr()); int statusCount = xmlDoc->getNodeCount (statusCountExpr());
statuses.clear(); statuses.clear();

View File

@ -86,7 +86,7 @@ void NotificationResponse::fromXML(XMLDocument *xmlDoc) throw (ParsingException)
padateStr = xmlDoc->getNodeValue(padateExpr()); padateStr = xmlDoc->getNodeValue(padateExpr());
result = (resultStr == "1"); result = (resultStr == "1");
paDate = std::auto_ptr<XMLGregorianCalendar>( paDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(
EPPDateFormatter::fromXSDateTime(padateStr)); EPPDateFormatter::fromXSDateTime(padateStr));
} }
catch (XPathExpressionException& e) catch (XPathExpressionException& e)

View File

@ -44,7 +44,7 @@ void testContactTransferApprovePoll()
results[0].getResultMessage()); results[0].getResultMessage());
ASSERT_EQ("ABC-12345", response.getCLTRID()); ASSERT_EQ("ABC-12345", response.getCLTRID());
const XMLGregorianCalendar *qDate1 = response.getMessageEnqueueDate(); constXMLGC::XMLGregorianCalendar *qDate1 = response.getMessageEnqueueDate();
std::string res = EPPDateFormatter::toXSDateTime(*qDate1); std::string res = EPPDateFormatter::toXSDateTime(*qDate1);
ASSERT_EQ(res, "2000-06-08T22:00:00.0Z"); ASSERT_EQ(res, "2000-06-08T22:00:00.0Z");
@ -76,7 +76,7 @@ void testDomainTransferApprovePoll()
results[0].getResultMessage()); results[0].getResultMessage());
ASSERT_EQ("ABC-12345", response.getCLTRID()); ASSERT_EQ("ABC-12345", response.getCLTRID());
const XMLGregorianCalendar *qDate1 = response.getMessageEnqueueDate(); constXMLGC::XMLGregorianCalendar *qDate1 = response.getMessageEnqueueDate();
std::string res = EPPDateFormatter::toXSDateTime(*qDate1); std::string res = EPPDateFormatter::toXSDateTime(*qDate1);
ASSERT_EQ(res, "2000-06-08T22:00:00.0Z"); ASSERT_EQ(res, "2000-06-08T22:00:00.0Z");

View File

@ -124,7 +124,7 @@ void Response::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
std::string msgQqDate = xmlDoc->getNodeValue(MSGQ_QDATE_EXPR()); std::string msgQqDate = xmlDoc->getNodeValue(MSGQ_QDATE_EXPR());
if (msgQqDate != "") if (msgQqDate != "")
qDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(msgQqDate)); qDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(msgQqDate));
msg = xmlDoc->getNodeValue(MSGQ_MSG_EXPR()); msg = xmlDoc->getNodeValue(MSGQ_MSG_EXPR());
msgLang = xmlDoc->getNodeValue (MSGQ_MSG_LANG_EXPR()); msgLang = xmlDoc->getNodeValue (MSGQ_MSG_LANG_EXPR());

View File

@ -60,12 +60,12 @@ void TransferResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
reID = xmlDoc->getNodeValue (reIDExpr()); reID = xmlDoc->getNodeValue (reIDExpr());
string reDateStr = xmlDoc->getNodeValue(reDateExpr()); string reDateStr = xmlDoc->getNodeValue(reDateExpr());
if (reDateStr.length() > 0) if (reDateStr.length() > 0)
reDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(reDateStr)); reDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(reDateStr));
acID = xmlDoc->getNodeValue(acIDExpr()); acID = xmlDoc->getNodeValue(acIDExpr());
string acDateStr = xmlDoc->getNodeValue (acDateExpr()); string acDateStr = xmlDoc->getNodeValue (acDateExpr());
if (acDateStr.length() > 0) if (acDateStr.length() > 0)
acDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(acDateStr)); acDate = std::auto_ptr<XMLGC::XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(acDateStr));
} }
catch (XPathExpressionException& e) catch (XPathExpressionException& e)
{ {

View File

@ -9,7 +9,7 @@
using namespace std; using namespace std;
const char * XMLGregorianCalendar::FIELD_NAME[] = const char *XMLGC::XMLGregorianCalendar::FIELD_NAME[] =
{ "Year", { "Year",
"Month", "Month",
"Day", "Day",
@ -19,7 +19,7 @@ const char * XMLGregorianCalendar::FIELD_NAME[] =
"Millisecond", "Millisecond",
"Timezone" }; "Timezone" };
const int XMLGregorianCalendar::daysInMonth[] = const intXMLGC::XMLGregorianCalendar::daysInMonth[] =
{ 0, // XML Schema months start at 1. { 0, // XML Schema months start at 1.
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
}; };
@ -68,7 +68,7 @@ class Parser
public: public:
Parser (const string &format, Parser (const string &format,
const string &value, const string &value,
XMLGregorianCalendar *calendar) XMLGC::XMLGregorianCalendar *calendar)
: calendar(calendar), format(format), value(value), flen(format.length()), : calendar(calendar), format(format), value(value), flen(format.length()),
vlen(value.length()), fidx(0), vidx(0) vlen(value.length()), fidx(0), vidx(0)
{ } { }
@ -148,7 +148,7 @@ public:
// End parse() // End parse()
private: private:
XMLGregorianCalendar *calendar; XMLGC::XMLGregorianCalendar *calendar;
string format, value; string format, value;
int flen, vlen; int flen, vlen;
@ -348,7 +348,7 @@ XMLGregorianCalendar::XMLGregorianCalendar(const string &lexicalRepresentation)
if (!isValid()) throw MalformedDateException("common.date.format"); if (!isValid()) throw MalformedDateException("common.date.format");
} }
bool XMLGregorianCalendar::isValid() const boolXMLGC::XMLGregorianCalendar::isValid() const
{ {
if (year == 0) if (year == 0)
return false; return false;
@ -373,7 +373,7 @@ bool XMLGregorianCalendar::isValid() const
return true; return true;
} }
void XMLGregorianCalendar::setMonth (int month) void XMLGC::XMLGregorianCalendar::setMonth (int month)
{ {
if ((month < JANUARY || DECEMBER < month) && month != FIELD_UNDEFINED) if ((month < JANUARY || DECEMBER < month) && month != FIELD_UNDEFINED)
invalidFieldValue (MONTH, month); invalidFieldValue (MONTH, month);
@ -381,7 +381,7 @@ void XMLGregorianCalendar::setMonth (int month)
this->month = month; this->month = month;
} }
void XMLGregorianCalendar::setDay (int day) void XMLGC::XMLGregorianCalendar::setDay (int day)
{ {
if ((day < 1 || 31 < day) && day != FIELD_UNDEFINED) if ((day < 1 || 31 < day) && day != FIELD_UNDEFINED)
invalidFieldValue (DAY, day); invalidFieldValue (DAY, day);
@ -389,7 +389,7 @@ void XMLGregorianCalendar::setDay (int day)
this->day = day; this->day = day;
} }
void XMLGregorianCalendar::setTimezone (int offset) void XMLGC::XMLGregorianCalendar::setTimezone (int offset)
{ {
if ((offset < -14*60 || 14*60 < offset) && offset != FIELD_UNDEFINED) if ((offset < -14*60 || 14*60 < offset) && offset != FIELD_UNDEFINED)
invalidFieldValue (TIMEZONE, offset); invalidFieldValue (TIMEZONE, offset);
@ -397,7 +397,7 @@ void XMLGregorianCalendar::setTimezone (int offset)
this->timezone = offset; this->timezone = offset;
} }
void XMLGregorianCalendar::setTime (int hour, void XMLGC::XMLGregorianCalendar::setTime (int hour,
int minute, int minute,
int second, int second,
long double fractional) long double fractional)
@ -419,7 +419,7 @@ void XMLGregorianCalendar::setTime (int hour,
testHour(); testHour();
} }
void XMLGregorianCalendar::testHour() void XMLGC::XMLGregorianCalendar::testHour()
{ {
if (hour == 24 && (getMinute() != 0 || if (hour == 24 && (getMinute() != 0 ||
getSecond() != 0)) getSecond() != 0))
@ -427,7 +427,7 @@ void XMLGregorianCalendar::testHour()
} }
void XMLGregorianCalendar::setHour (int hour, bool validate) void XMLGC::XMLGregorianCalendar::setHour (int hour, bool validate)
{ {
if ((hour < 0 || hour > 24) && hour != FIELD_UNDEFINED) if ((hour < 0 || hour > 24) && hour != FIELD_UNDEFINED)
invalidFieldValue (HOUR, hour); invalidFieldValue (HOUR, hour);
@ -438,7 +438,7 @@ void XMLGregorianCalendar::setHour (int hour, bool validate)
testHour(); testHour();
} }
void XMLGregorianCalendar::setMinute (int minute) void XMLGC::XMLGregorianCalendar::setMinute (int minute)
{ {
if ((minute < 0 || 59 < minute) && minute != FIELD_UNDEFINED) if ((minute < 0 || 59 < minute) && minute != FIELD_UNDEFINED)
invalidFieldValue (MINUTE, minute); invalidFieldValue (MINUTE, minute);
@ -446,7 +446,7 @@ void XMLGregorianCalendar::setMinute (int minute)
this->minute = minute; this->minute = minute;
} }
void XMLGregorianCalendar::setSecond (int second) void XMLGC::XMLGregorianCalendar::setSecond (int second)
{ {
if ((second < 0 || 60 < second) && // leap second allows for 60 if ((second < 0 || 60 < second) && // leap second allows for 60
second != FIELD_UNDEFINED) second != FIELD_UNDEFINED)
@ -457,7 +457,7 @@ void XMLGregorianCalendar::setSecond (int second)
this->second = second; this->second = second;
} }
void XMLGregorianCalendar::setFractionalSecond(long double fractional) void XMLGC::XMLGregorianCalendar::setFractionalSecond(long double fractional)
{ {
if (fractional < 0.0 || fractional >= 1.0) if (fractional < 0.0 || fractional >= 1.0)
throw IllegalArgException ("Invalid fractional seconds"); throw IllegalArgException ("Invalid fractional seconds");
@ -470,12 +470,12 @@ QName getXMLSchemaType(int year, int month, int day, int hour, int minute, int s
throw (IllegalStateException) throw (IllegalStateException)
{ {
unsigned int mask = unsigned int mask =
(year != XMLGregorianCalendar::FIELD_UNDEFINED ? 0x20 : 0) | (year !=XMLGC::XMLGregorianCalendar::FIELD_UNDEFINED ? 0x20 : 0) |
(month != XMLGregorianCalendar::FIELD_UNDEFINED ? 0x10 : 0) | (month !=XMLGC::XMLGregorianCalendar::FIELD_UNDEFINED ? 0x10 : 0) |
(day != XMLGregorianCalendar::FIELD_UNDEFINED ? 0x08 : 0) | (day !=XMLGC::XMLGregorianCalendar::FIELD_UNDEFINED ? 0x08 : 0) |
(hour != XMLGregorianCalendar::FIELD_UNDEFINED ? 0x04 : 0) | (hour !=XMLGC::XMLGregorianCalendar::FIELD_UNDEFINED ? 0x04 : 0) |
(minute != XMLGregorianCalendar::FIELD_UNDEFINED ? 0x02 : 0) | (minute !=XMLGC::XMLGregorianCalendar::FIELD_UNDEFINED ? 0x02 : 0) |
(second != XMLGregorianCalendar::FIELD_UNDEFINED ? 0x01 : 0); (second !=XMLGC::XMLGregorianCalendar::FIELD_UNDEFINED ? 0x01 : 0);
switch (mask) switch (mask)
{ {
@ -517,7 +517,7 @@ QName getXMLSchemaType(int year, int month, int day, int hour, int minute, int s
// End switch // End switch
} }
string XMLGregorianCalendar::toXMLFormat() const stringXMLGC::XMLGregorianCalendar::toXMLFormat() const
{ {
string formatString; string formatString;
@ -563,7 +563,7 @@ string XMLGregorianCalendar::toXMLFormat() const
return format (formatString); return format (formatString);
} }
string XMLGregorianCalendar::format (const string &format) const stringXMLGC::XMLGregorianCalendar::format (const string &format) const
{ {
string buf; string buf;
@ -646,7 +646,7 @@ string XMLGregorianCalendar::format (const string &format) const
} }
long double XMLGregorianCalendar::getSeconds() const long doubleXMLGC::XMLGregorianCalendar::getSeconds() const
{ {
if (second == FIELD_UNDEFINED) if (second == FIELD_UNDEFINED)
return 0.0L; return 0.0L;
@ -655,7 +655,7 @@ long double XMLGregorianCalendar::getSeconds() const
} }
int XMLGregorianCalendar::maximumDayInMonthFor (long long year, int month) intXMLGC::XMLGregorianCalendar::maximumDayInMonthFor (long long year, int month)
{ {
if (month != FEBRUARY) if (month != FEBRUARY)
return daysInMonth[month]; return daysInMonth[month];
@ -670,7 +670,7 @@ int XMLGregorianCalendar::maximumDayInMonthFor (long long year, int month)
} }
} }
void XMLGregorianCalendar::invalidFieldValue (int field, int value) void XMLGC::XMLGregorianCalendar::invalidFieldValue (int field, int value)
throw (IllegalArgException) throw (IllegalArgException)
{ {
throw IllegalArgException( throw IllegalArgException(

View File

@ -13,27 +13,27 @@ using namespace std;
void testNoFractionalSecondSet() void testNoFractionalSecondSet()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
ASSERT_EQ(calendar.getFractionalSecond(), 0); ASSERT_EQ(calendar.getFractionalSecond(), 0);
} }
void testSetZeroFractionalSecond() void testSetZeroFractionalSecond()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
calendar.setFractionalSecond(0.0); calendar.setFractionalSecond(0.0);
ASSERT_EQ(calendar.getFractionalSecond(), 0); ASSERT_EQ(calendar.getFractionalSecond(), 0);
} }
void testSetNonZeroFractionalSecond() void testSetNonZeroFractionalSecond()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
calendar.setFractionalSecond(0.123); calendar.setFractionalSecond(0.123);
ASSERT_EQ(calendar.getFractionalSecond(), 0.123); ASSERT_EQ(calendar.getFractionalSecond(), 0.123);
} }
void testSetNegativeFractionalSecond() void testSetNegativeFractionalSecond()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
try try
{ {
@ -48,7 +48,7 @@ void testSetNegativeFractionalSecond()
void testSetFractionalSecondToWholeSecond() void testSetFractionalSecondToWholeSecond()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
try try
{ {
@ -69,7 +69,7 @@ void testSetFractionalSecondToWholeSecond()
*/ */
void testValidYearSet() void testValidYearSet()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
calendar.setDay(1); calendar.setDay(1);
calendar.setMonth(3); calendar.setMonth(3);
calendar.setYear(2010); calendar.setYear(2010);
@ -78,7 +78,7 @@ void testValidYearSet()
void testInvalidNoYearSet() void testInvalidNoYearSet()
{ {
XMLGregorianCalendar calendar("2015-04-08T04:23:29.0Z"); XMLGC::XMLGregorianCalendar calendar("2015-04-08T04:23:29.0Z");
ASSERT_EQ(calendar.isValid(), true); ASSERT_EQ(calendar.isValid(), true);
calendar.setYear(0); calendar.setYear(0);
ASSERT_EQ(calendar.isValid(), false); ASSERT_EQ(calendar.isValid(), false);
@ -86,7 +86,7 @@ void testInvalidNoYearSet()
void testInvalidNonLeapYear() void testInvalidNonLeapYear()
{ {
XMLGregorianCalendar calendar("2009-02-08T04:23:29.0Z"); XMLGC::XMLGregorianCalendar calendar("2009-02-08T04:23:29.0Z");
ASSERT_EQ(calendar.isValid(), true); ASSERT_EQ(calendar.isValid(), true);
calendar.setDay(29); calendar.setDay(29);
ASSERT_EQ(calendar.isValid(), false); ASSERT_EQ(calendar.isValid(), false);
@ -94,7 +94,7 @@ void testInvalidNonLeapYear()
void testFormatYear() void testFormatYear()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
calendar.setYear(2015); calendar.setYear(2015);
ASSERT_EQ(calendar.format("%Y"), "2015"); ASSERT_EQ(calendar.format("%Y"), "2015");
} }
@ -106,14 +106,14 @@ void testFormatYear()
void testValidNegativeYear() void testValidNegativeYear()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
calendar.setYear(-2102); calendar.setYear(-2102);
ASSERT_EQ(calendar.isValid(), true); ASSERT_EQ(calendar.isValid(), true);
} }
void testFormatNegativeYear() void testFormatNegativeYear()
{ {
XMLGregorianCalendar calendar; XMLGC::XMLGregorianCalendar calendar;
calendar.setYear(-2015); calendar.setYear(-2015);
ASSERT_EQ(calendar.format("%Y"), "-2015"); ASSERT_EQ(calendar.format("%Y"), "-2015");
} }