From: Asbjorn M. <ste...@us...> - 2002-05-22 09:54:13
|
Update of /cvsroot/epp-rtk/epp-rtk/c++/src In directory usw-pr-cvs1:/tmp/cvs-serv26190 Modified Files: main_contacttransfer.cc main_domaintransfer.cc Log Message: Added -testdata option to provide data to test programs. Index: main_contacttransfer.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_contacttransfer.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** main_contacttransfer.cc 15 Mar 2002 16:34:22 -0000 1.9 --- main_contacttransfer.cc 22 May 2002 09:54:07 -0000 1.10 *************** *** 1,28 **** /************************************************************************ ! * EPP RTK C++ ! * Copyright (C) 2001, 2002 The Global Name Registry, Limited ! * ! * This library is free software; you can redistribute it and/or modify it ! * under the terms of the GNU Lesser General Public License as published ! * by the Free Software Foundation; either version 2.1 of the License, or ! * (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, but ! * WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * Contact information: ep...@gn... ! * ! * EPP RTK ! * The Global Name Registry, Limited ! * 125 High Holborn ! * London WC1V 6QA ! * United Kingdom ! ************************************************************************/ #include <string> --- 1,28 ---- /************************************************************************ ! * EPP RTK C++ ! * Copyright (C) 2001, 2002 The Global Name Registry, Limited ! * ! * This library is free software; you can redistribute it and/or modify it ! * under the terms of the GNU Lesser General Public License as published ! * by the Free Software Foundation; either version 2.1 of the License, or ! * (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, but ! * WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * Contact information: ep...@gn... ! * ! * EPP RTK ! * The Global Name Registry, Limited ! * 125 High Holborn ! * London WC1V 6QA ! * United Kingdom ! ************************************************************************/ #include <string> *************** *** 91,130 **** return 1; testLogIn(test, username, password); try { - // REQ-test: epp_ContactTransferReq_ref l_req(new epp_ContactTransferReq()); l_req->m_cmd.ref(new epp_Command(NULL, NULL, ! epp_trid("ABC-12345"))); ! ! l_req->m_id.ref(new epp_string("sh8013")); ! l_req->m_trans.ref(new epp_TransferRequest()); ! l_req->m_trans->m_op.ref(new epp_TransferOpType(REQUEST)); ! l_req->m_trans->m_auth_info.ref(new epp_AuthInfo()); ! l_req->m_trans->m_auth_info->m_type.ref(new epp_AuthInfoType(PW)); ! l_req->m_trans->m_auth_info->m_value.ref(new epp_string("2fooBAR")); epp_ContactTransfer_ref l_obj(new epp_ContactTransfer()); ! l_obj->setRequestData(*l_req); ! ! test.processAction(l_obj); ! ! epp_ContactTransferRsp_ref l_rsp = l_obj->getResponseData(); ! #ifndef TEST_IO_REQUEST2CERR ! printRsp(l_rsp); #endif ! ! cout << "\n----------------------------------\n"; ! ! // QUERY-test: ! ! *l_req->m_trans->m_op = QUERY; ! l_req->m_trans->m_auth_info.ref(NULL); l_obj->setRequestData(*l_req); --- 91,165 ---- return 1; + map<int,string> testDataMap; + + if(argc > 1) { + for(int parm = 1; parm < argc; parm++) { + + if (!strncmp(argv[parm], "-testdata=", 10)) { + string td = &argv[parm][10]; + testDataMap = getTestDataMap(td); + } + } + } + testLogIn(test, username, password); try { epp_ContactTransferReq_ref l_req(new epp_ContactTransferReq()); + string trID; + if(testDataMap.empty()) trID = "ABC-12345"; + else trID = testDataMap[1]; + l_req->m_cmd.ref(new epp_Command(NULL, NULL, ! epp_trid(trID))); epp_ContactTransfer_ref l_obj(new epp_ContactTransfer()); + epp_ContactTransferRsp_ref l_rsp; ! if(testDataMap.empty()) { ! ! // REQ-test: ! l_req->m_id.ref(new epp_string("sh8013")); ! l_req->m_trans.ref(new epp_TransferRequest()); ! l_req->m_trans->m_op.ref(new epp_TransferOpType(REQUEST)); ! l_req->m_trans->m_auth_info.ref(new epp_AuthInfo()); ! l_req->m_trans->m_auth_info->m_type.ref(new epp_AuthInfoType(PW)); ! l_req->m_trans->m_auth_info->m_value.ref(new epp_string("2fooBAR")); ! ! ! l_obj->setRequestData(*l_req); ! ! test.processAction(l_obj); ! ! l_rsp = l_obj->getResponseData(); ! #ifndef TEST_IO_REQUEST2CERR ! printRsp(l_rsp); #endif ! ! cout << "\n----------------------------------\n"; ! ! // QUERY-test: ! *l_req->m_trans->m_op = QUERY; ! l_req->m_trans->m_auth_info.ref(NULL); ! ! } ! else { ! if(testDataMap[2] != "-1") l_req->m_id.ref(new epp_string(testDataMap[2])); ! ! if(testDataMap[3] != "-1") { ! l_req->m_trans.ref(new epp_TransferRequest()); ! l_req->m_trans->m_op.ref(new epp_TransferOpType(returnTransferType(testDataMap[3]))); ! } ! ! if(testDataMap[4] != "-1") { ! l_req->m_trans->m_auth_info.ref(new epp_AuthInfo()); ! l_req->m_trans->m_auth_info->m_type.ref(new epp_AuthInfoType(PW)); ! l_req->m_trans->m_auth_info->m_value.ref(new epp_string(testDataMap[4])); ! } ! } l_obj->setRequestData(*l_req); Index: main_domaintransfer.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_domaintransfer.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** main_domaintransfer.cc 15 Mar 2002 16:34:22 -0000 1.9 --- main_domaintransfer.cc 22 May 2002 09:54:07 -0000 1.10 *************** *** 1,28 **** /************************************************************************ ! * EPP RTK C++ ! * Copyright (C) 2001, 2002 The Global Name Registry, Limited ! * ! * This library is free software; you can redistribute it and/or modify it ! * under the terms of the GNU Lesser General Public License as published ! * by the Free Software Foundation; either version 2.1 of the License, or ! * (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, but ! * WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * Contact information: ep...@gn... ! * ! * EPP RTK ! * The Global Name Registry, Limited ! * 125 High Holborn ! * London WC1V 6QA ! * United Kingdom ! ************************************************************************/ #include <string> --- 1,28 ---- /************************************************************************ ! * EPP RTK C++ ! * Copyright (C) 2001, 2002 The Global Name Registry, Limited ! * ! * This library is free software; you can redistribute it and/or modify it ! * under the terms of the GNU Lesser General Public License as published ! * by the Free Software Foundation; either version 2.1 of the License, or ! * (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, but ! * WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * Contact information: ep...@gn... ! * ! * EPP RTK ! * The Global Name Registry, Limited ! * 125 High Holborn ! * London WC1V 6QA ! * United Kingdom ! ************************************************************************/ #include <string> *************** *** 94,97 **** --- 94,109 ---- return 1; + map<int,string> testDataMap; + + if(argc > 1) { + for(int parm = 1; parm < argc; parm++) { + + if (!strncmp(argv[parm], "-testdata=", 10)) { + string td = &argv[parm][10]; + testDataMap = getTestDataMap(td); + } + } + } + testLogIn(test, username, password); *************** *** 99,138 **** epp_DomainTransferReq_ref l_req(new epp_DomainTransferReq()); l_req->m_cmd.ref(new epp_Command(NULL, NULL, ! epp_trid("ABC-12345"))); ! ! // REQ-test: ! ! l_req->m_name.ref(new epp_string("example.com")); ! l_req->m_trans.ref(new epp_TransferRequest()); ! l_req->m_trans->m_op.ref(new epp_TransferOpType(REQUEST)); ! l_req->m_trans->m_auth_info.ref(new epp_AuthInfo()); ! l_req->m_trans->m_auth_info->m_type.ref(new epp_AuthInfoType(PW)); ! l_req->m_trans->m_auth_info->m_roid.ref(new epp_roid("JD1234-VRSN")); ! l_req->m_trans->m_auth_info->m_value.ref(new epp_string("2fooBAR")); ! l_req->m_period.ref(new epp_DomainPeriod(YEAR, 1)); epp_DomainTransfer_ref l_obj(new epp_DomainTransfer()); ! l_obj->setRequestData(*l_req); ! ! test.processAction(l_obj); ! ! epp_DomainTransferRsp_ref l_rsp = l_obj->getResponseData(); ! #ifndef TEST_IO_REQUEST2CERR ! printRsp(l_rsp); #endif ! cout << "\n----------------------------------\n"; ! ! ! // QUERY-test: ! ! *l_req->m_trans->m_op = QUERY; ! l_req->m_trans->m_auth_info.ref(NULL); ! l_req->m_period.ref(NULL); l_obj->setRequestData(*l_req); --- 111,176 ---- epp_DomainTransferReq_ref l_req(new epp_DomainTransferReq()); + + string trID; + if(testDataMap.empty()) trID = "ABC-12345"; + else trID = testDataMap[1]; l_req->m_cmd.ref(new epp_Command(NULL, NULL, ! epp_trid(trID))); epp_DomainTransfer_ref l_obj(new epp_DomainTransfer()); + epp_DomainTransferRsp_ref l_rsp; ! if(testDataMap.empty()) { ! ! // REQ-test: ! l_req->m_name.ref(new epp_string("example.com")); ! l_req->m_trans.ref(new epp_TransferRequest()); ! l_req->m_trans->m_op.ref(new epp_TransferOpType(REQUEST)); ! l_req->m_trans->m_auth_info.ref(new epp_AuthInfo()); ! l_req->m_trans->m_auth_info->m_type.ref(new epp_AuthInfoType(PW)); ! l_req->m_trans->m_auth_info->m_roid.ref(new epp_roid("JD1234-VRSN")); ! l_req->m_trans->m_auth_info->m_value.ref(new epp_string("2fooBAR")); ! l_req->m_period.ref(new epp_DomainPeriod(YEAR, 1)); ! ! ! l_obj->setRequestData(*l_req); ! ! test.processAction(l_obj); ! ! l_rsp = l_obj->getResponseData(); ! #ifndef TEST_IO_REQUEST2CERR ! printRsp(l_rsp); #endif + + cout << "\n----------------------------------\n"; + + + // QUERY-test: + *l_req->m_trans->m_op = QUERY; + l_req->m_trans->m_auth_info.ref(NULL); + l_req->m_period.ref(NULL); + } + else { + if(testDataMap[2] != "-1") l_req->m_name.ref(new epp_string(testDataMap[2])); + + if(testDataMap[3] != "-1") { + l_req->m_trans.ref(new epp_TransferRequest()); + l_req->m_trans->m_op.ref(new epp_TransferOpType(returnTransferType(testDataMap[3]))); + } + + if(testDataMap[4] != "" && testDataMap[4] != "-1") { + l_req->m_period.ref(new epp_DomainPeriod(YEAR, atol(testDataMap[4].c_str()))); + } ! if(testDataMap[5] != "" && testDataMap[5] != "-1") { ! l_req->m_trans->m_auth_info.ref(new epp_AuthInfo()); ! l_req->m_trans->m_auth_info->m_type.ref(new epp_AuthInfoType(PW)); ! l_req->m_trans->m_auth_info->m_value.ref(new epp_string(testDataMap[5])); ! } ! ! } l_obj->setRequestData(*l_req); |