Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 93744 invoked from network); 16 Feb 2005 14:27:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Feb 2005 14:27:12 -0000 Received: (qmail 86919 invoked by uid 500); 16 Feb 2005 14:27:12 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 86597 invoked by uid 500); 16 Feb 2005 14:27:10 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 86583 invoked by uid 99); 16 Feb 2005 14:27:10 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 16 Feb 2005 06:27:10 -0800 Received: (qmail 93702 invoked by uid 1927); 16 Feb 2005 14:27:09 -0000 Date: 16 Feb 2005 14:27:09 -0000 Message-ID: <20050216142709.93701.qmail@minotaur.apache.org> From: perryan@apache.org To: ws-axis-cvs@apache.org Subject: cvs commit: ws-axis/c/tests/auto_build/testcases/tests TestSetHandlerProperty.xml X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N perryan 2005/02/16 06:27:09 Added: c/tests/auto_build/testcases/client/cpp TestSetHandlerPropertyClient.cpp c/tests/auto_build/testcases/handlers/TestSetHandlerProperty/testhandler THandler.cpp THandler.h TestHandler.cpp c/tests/auto_build/testcases/output TestSetHandlerProperty.expected c/tests/auto_build/testcases/tests TestSetHandlerProperty.xml Log: Added setHandlerProperty test for Manohar Revision Changes Path 1.1 ws-axis/c/tests/auto_build/testcases/client/cpp/TestSetHandlerPropertyClient.cpp Index: TestSetHandlerPropertyClient.cpp =================================================================== /* ***************************************************************************** * This test tests the functionality of setHandlerProperty() of Stub class. * Test Logic * Set a value for a property and and get it's value in Handler and also * set the value for a property in handler and get that value in Client. * * The test is supposed to be passed when values set in client are * received in handler and vice versa. ***************************************************************************** */ #include "Calculator.hpp" #include int main(int argc, char* argv[]) { char endpoint[256]; const char* url="http://localhost:80/axis/Calculator"; int iResult; url = argv[1]; try { sprintf(endpoint, "%s", url); Calculator ws(endpoint); char buffer[100]; char* pbuff=buffer; ws.setHandlerProperty("prop1", (void*)"value1", 7); ws.setHandlerProperty("prop2", &pbuff, 100); iResult = ws.add(2,3); cout << iResult << endl; cout << "value of prop2 printed in client is = " << buffer << endl; } catch(AxisException& e) { printf("Exception : %s\n", e.what()); } catch(exception& e) { printf("Unknown exception has occured\n" ); } catch(...) { printf("Unknown exception has occured\n" ); } cout << "---------------- TEST COMPLETE ----------------" << endl; return 0; } 1.1 ws-axis/c/tests/auto_build/testcases/handlers/TestSetHandlerProperty/testhandler/THandler.cpp Index: THandler.cpp =================================================================== /* * Copyright 2003-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * @author Manohar Chintala (cmanohar@in.ibm.com) * ***************************************************************************** * Test Logic. * Get value of a property which is set in client in the resquest. * * In the response, set a value into the buffer whose address is passed in from * client and get that value in client. This way we can ensure that values * set in the client is received in handler and values set in handler are * received in client. * ***************************************************************************** */ #include "THandler.h" #include #include #include #include #include THandler::THandler() { m_pOption = NULL; m_sEmpty = ""; } THandler::~THandler() { } const string& THandler::getOption(const string& sArg) { map::const_iterator it = m_pOption->find(sArg); if (it != m_pOption->end()) { return (*it).second; } return m_sEmpty; } void THandler::setOptionList(const map* OptionList) { m_pOption = OptionList; } int THandler::invoke(void *pvIMsg) { IMessageData *pIMsg = (IMessageData*) pvIMsg; if(pIMsg->isPastPivot()) { /*this is a response*/ char** chk1 = (char**)pIMsg->getProperty("prop2"); strcpy(*chk1, "value2"); cout << "value of prop2 set in handler is = " << *chk1 << endl; } else { /*this is a request*/ char* chk2 = (char*) pIMsg->getProperty("prop1"); cout << "value of prop1 is = " << chk2 << endl; } return AXIS_SUCCESS; } void THandler::onFault(void *pvIMsg) { } int THandler::init() { //do any initialization, resetting of values return AXIS_SUCCESS; } int THandler::fini() { //do any finalizatoin return AXIS_SUCCESS; } 1.1 ws-axis/c/tests/auto_build/testcases/handlers/TestSetHandlerProperty/testhandler/THandler.h Index: THandler.h =================================================================== /* * Copyright 2003-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * @author Andrew Perry (perryan@uk.ibm.com) * ***************************************************************************** * Test Logic. * Get an empty property in the response and make sure it is empty. * * Test success is measured by comparing the actual response with an expected * response. So on failure just write anything to stdout and the test will * fail. ***************************************************************************** * */ #if !defined(_THANDLER_H____OF_AXIS_INCLUDED_) #define _THANDLER_H____OF_AXIS_INCLUDED_ #include AXIS_CPP_NAMESPACE_USE class THandler : public Handler { public: int AXISCALL fini(); int AXISCALL init(); void AXISCALL onFault(void* pvIMsg); int AXISCALL invoke(void* pvIMsg); void setOptionList(const map* OptionList); const string& getOption(const string& sArg); THandler(); virtual ~THandler(); protected: string m_sEmpty; }; #endif // !defined(_THANDLER_H____OF_AXIS_INCLUDED_) 1.1 ws-axis/c/tests/auto_build/testcases/handlers/TestSetHandlerProperty/testhandler/TestHandler.cpp Index: TestHandler.cpp =================================================================== /* * Copyright 2003-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * @author Andrew Perry (perryan@uk.ibm.com) * ***************************************************************************** * Test Logic. * Get an empty property in the response and make sure it is empty. * * Test success is measured by comparing the actual response with an expected * response. So on failure just write anything to stdout and the test will * fail. ***************************************************************************** * */ // ////////////////////////////////////////////////////////////////////// #include "THandler.h" #include extern "C" { //the two export functions//////////////////////////////////////////// //Following describes how the export function of the handler DLLs (or .so s) STORAGE_CLASS_INFO int GetClassInstance(BasicHandler **inst) { *inst = new BasicHandler(); THandler* pTHandler = new THandler(); (*inst)->_functions = 0; if (pTHandler) { (*inst)->_object = pTHandler; return pTHandler->init(); } return AXIS_FAIL; } STORAGE_CLASS_INFO int DestroyInstance(BasicHandler *inst) { if (inst) { Handler* pH = static_cast(inst->_object); pH->fini(); delete pH; delete inst; return AXIS_SUCCESS; } return AXIS_FAIL; } } 1.1 ws-axis/c/tests/auto_build/testcases/output/TestSetHandlerProperty.expected Index: TestSetHandlerProperty.expected =================================================================== value of prop1 is = value1 value of prop2 set in handler is = value2 5 value of prop2 printed in client is = value2 ---------------- TEST COMPLETE ---------------- 1.1 ws-axis/c/tests/auto_build/testcases/tests/TestSetHandlerProperty.xml Index: TestSetHandlerProperty.xml =================================================================== TestSetHandlerProperty CalculatorDoc with Handler and IMessageData->getProperty() when no property set cpp TestSetHandlerPropertyClient.cpp CalculatorDoc.wsdl TestSetHandlerProperty.expected TestSetHandlerProperty Calculator http://localhost:80/Calculator/services/Calculator