You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2004/05/20 07:51:02 UTC

cvs commit: ws-axis/c/tests/unit_tests/cppunit/common ArrayBeanTestCase.cpp ArrayBeanTestCase.h AxisConfigTestCase.cpp AxisConfigTestCase.h AxisSocketUtilsTestCase.cpp AxisSocketUtilsTestCase.h AxisTraceTestCase.cpp AxisTraceTestCase.h AxisUtilsTestCase.cpp AxisUtilsTestCase.h BasicTypeSerializerTestCase.cpp BasicTypeSerializerTestCase.h MainFile.cpp TypeMappingTestCase.cpp TypeMappingTestCase.h

damitha     2004/05/19 22:51:02

  Modified:    c/samples/client/rpcfault MathOps.cpp
  Added:       c/tests/unit_tests/cppunit/client CallTestCase.cpp
                        CallTestCase.h ClientMain.cpp
               c/tests/unit_tests/cppunit/common ArrayBeanTestCase.cpp
                        ArrayBeanTestCase.h AxisConfigTestCase.cpp
                        AxisConfigTestCase.h AxisSocketUtilsTestCase.cpp
                        AxisSocketUtilsTestCase.h AxisTraceTestCase.cpp
                        AxisTraceTestCase.h AxisUtilsTestCase.cpp
                        AxisUtilsTestCase.h BasicTypeSerializerTestCase.cpp
                        BasicTypeSerializerTestCase.h MainFile.cpp
                        TypeMappingTestCase.cpp TypeMappingTestCase.h
  Log:
  moved the unit_tests and test_cases from src to newly created tests folder in root
  
  Revision  Changes    Path
  1.4       +12 -8     ws-axis/c/samples/client/rpcfault/MathOps.cpp
  
  Index: MathOps.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/MathOps.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MathOps.cpp	20 May 2004 03:48:03 -0000	1.3
  +++ MathOps.cpp	20 May 2004 05:51:01 -0000	1.4
  @@ -50,14 +50,18 @@
                   else if(AXIS_SUCCESS == m_pCall->checkMessage("fault",
                       "http://localhost/axis/MathOps")) //Exception handling code goes here
                   {
  -                    cFaultcode = m_pCall->getElementAsChar("", 0);
  -                    cFaultstring = m_pCall->getElementAsChar("", 0); 
  -                    cFaultactor = m_pCall->getElementAsChar("", 0);
  -                    SOAPStructFault* pFaultDetail = NULL;
  -                    pFaultDetail = (SOAPStructFault*)m_pCall->
  -                        getCmplxObject((void*) Axis_DeSerialize_SOAPStructFault, 
  -                        (void*) Axis_Create_SOAPStructFault, 
  -                        (void*) Axis_Delete_SOAPStructFault,"faultstruct", 0);
  +                    cFaultcode = m_pCall->getElementAsString("faultcode", 0);
  +                    cFaultstring = m_pCall->getElementAsString("faultstring", 0); 
  +                    cFaultactor = m_pCall->getElementAsString("faultactor", 0);
  +                    if(AXIS_SUCCESS == m_pCall->checkMessage("detail",
  +                        "http://localhost/axis/MathOps"))
  +                    {
  +                        SOAPStructFault* pFaultDetail = NULL;
  +                        pFaultDetail = (SOAPStructFault*)m_pCall->
  +                            getCmplxObject((void*) Axis_DeSerialize_SOAPStructFault, 
  +                            (void*) Axis_Create_SOAPStructFault, 
  +                            (void*) Axis_Delete_SOAPStructFault,"faultstruct", 0);
  +                    }
                   }
   	}
   	m_pCall->unInitialize();
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/client/CallTestCase.cpp
  
  Index: CallTestCase.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.
   */
  
  /*  allTestCase.cpp: implementation of the CallTestCase class. */
  
  
  #include "axis/test_cases/cppunit/client/CallTestCase.h"
  
  
  CallTestCase::CallTestCase()
  {
  
  }
  
  CallTestCase::~CallTestCase()
  {
  
  }
  
  void CallTestCase::setUp()
  {
      pCall = new Call();
  /*    pSoap = new SoapDeSerializer(); */
  
  
  }
  
  void CallTestCase::tearDown()
  {
      delete pCall;
      pCall = NULL;
  
  }
  
  
  Test* CallTestCase::suite()
  {
      TestSuite* testSuite = new TestSuite("CallTestCase");
  
      testSuite->addTest (new TestCaller <CallTestCase>
        ("testGetElementAsInt", &CallTestCase::testGetElementAsInt));
  
      return testSuite;
  
  }
  
  void CallTestCase::testGetElementAsInt()
  {
      int ExpectedInt = 10;
   
      const AxisChar* myString ="TestString";
      const AxisChar* myString1 ="Test";
  
  
      int iResult = pCall->GetElementAsInt(myString, myString1);
  
  
      CPPUNIT_ASSERT_EQUAL(ExpectedInt, iResult);
  }
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/client/CallTestCase.h
  
  Index: CallTestCase.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.
   */
  
  /* allTestCase.h: interface for the CallTestCase class. */
  
  #if !defined(AXIS_ALLTESTCASE_H__OF_AXIS_INCLUDED_)
  #define AXIS_ALLTESTCASE_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include <list>
  #include "axis/client/Call.h"
  #include "axis/soap/SoapDeSerializer.h"
  
  
  using namespace CppUnit;
  using namespace std;
  
  
  class CallTestCase  : public TestCase
  {
  private:
      Call* pCall;
      /* SoapDeSerializer* pSoap; */
  public:
      void testGetElementAsInt();
      
      void tearDown();
      void setUp();
      CallTestCase();
      virtual ~CallTestCase();
      static Test* suite();
  
  };
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/client/ClientMain.cpp
  
  Index: ClientMain.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.
   */
  
  #include "cppunit\ui\text\TestRunner.h"
  #include "axis/test_cases/cppunit/client/CallTestCase.h"
  
  
  using namespace CppUnit::TextUi;
  
  int main(int argc, char* argv[])
  {
  
      TestRunner runner;
  
      runner.addTest(CallTestCase::suite());
      runner.run("CallTestCase");
  
  /*
      //runner.addTest(TypeMappingTestCase::suite());
      //runner.run("TypeMappingTestCase");
  
  
      //runner.addTest(AxisUtilsTestCase::suite());
      //runner.run("AxisUtilsTestCase");
  
  ////////////// Runner for AxisArrayBeanTest //////////////////
      //runner.addTest(ArrayBeanTestCase::suite());
      //runner.run("ArrayBeanTestCase");
  
  
  ///////////// Runner for AxisConfigTestCase  /////////////////
      //runner.addTest(AxisConfigTestCase::suite());
      //runner.run("AxisConfigTestCase");
  
  /////////////  OK Runner for BasicTypeSerializer ////////////////
  
      //runner.addTest(BasicTypeSerializerTest::suite());
      //runner.run("BasicTypeSerializerTest");
  
  ///////////// Runner for AxisSocketUtilsTestCase /////////////
      //runner.addTest(AxisSocketUtilsTestCase::suite());
      //runner.run("AxisSocketUtilsTestCase");
      
  ////////////// OK Runner for ParamTestCase /////////////////
  
      //runner.addTest(ParamTestCase::suite());
      //runner.run("ParamTestCase");
  */
  
      return 0;
  }
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/ArrayBeanTestCase.cpp
  
  Index: ArrayBeanTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  /* ArrayBeanTestCase.cpp: implementation of the ArrayBeanTestCase class. */
  
  
  #include "axis/test_cases/cppunit/common/ArrayBeanTestCase.h"
  
  
  ArrayBeanTestCase::ArrayBeanTestCase()
  {
  
  }
  
  ArrayBeanTestCase::~ArrayBeanTestCase()
  {
  
  }
  
  void ArrayBeanTestCase::setUp()
  {
      pArrayBean = new ArrayBean();
  
  }
  
  void ArrayBeanTestCase::tearDown()
  {
      delete pArrayBean;
      pArrayBean = NULL;
  }
  
  
  void ArrayBeanTestCase::testGetArraySize()
  {
      pArrayBean->m_nSize = 10;
  
      int ExpectedSize = 10;
      int iResult;
  
      iResult = pArrayBean->GetArraySize();
  
      CPPUNIT_ASSERT_EQUAL(ExpectedSize, iResult);
  
  
  
  
  }
  
  Test* ArrayBeanTestCase::suite()
  {
      TestSuite* testSuite = new TestSuite("ArrayBeanTestCase");
  
      testSuite->addTest (new TestCaller <ArrayBeanTestCase>
        ("testGetArraySize", &ArrayBeanTestCase::testGetArraySize));
  
      return testSuite;
  
  }
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/ArrayBeanTestCase.h
  
  Index: ArrayBeanTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  /* ArrayBeanTestCase.h: interface for the ArrayBeanTestCase class. */
  
  
  
  #if !defined(AXIS_ARRAYBEANTESTCASE_H_OF_AXIS_INCLUDED_)
  #define AXIS_ARRAYBEANTESTCASE_H_OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include <list>
  #include "axis/common/ArrayBean.h"
  
  using namespace CppUnit;
  using namespace std;
  
  class ArrayBeanTestCase : public TestCase
  {
  private:
      ArrayBean* pArrayBean;
  public:
      void testAxisConfig();
      void testSetItemName(const AxisChar* name);
      
      
      void tearDown();
      void setUp();
      void testGetArraySize();
      
      static Test* suite();
      ArrayBeanTestCase();
      ArrayBeanTestCase(string sName) : TestCase(sName) {}
      virtual ~ArrayBeanTestCase();
  
  };
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisConfigTestCase.cpp
  
  Index: AxisConfigTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #include "axis/test_cases/cppunit/common/AxisConfigTestCase.h"
  
  
  AxisConfigTestCase::AxisConfigTestCase()
  {
  
  }
  
  AxisConfigTestCase::~AxisConfigTestCase()
  { 
  
  }
  
  void AxisConfigTestCase::setUp()
  {
      pAxisConfig = new AxisConfig();
  
  }
  
  void AxisConfigTestCase::tearDown()
  {
      delete pAxisConfig;
      pAxisConfig = NULL;
  }
  
  
  void AxisConfigTestCase::testGetAxisLogPath()
  {
      char* Expectedpath="Axis\\logs\\";
      char* LogPath;
  
      LogPath = pAxisConfig->GetAxisLogPath();
      Expectedpath = LogPath;
  
      CPPUNIT_ASSERT_EQUAL(Expectedpath, LogPath);
  
  }
  
  
  
  Test* AxisConfigTestCase::suite()
  {
      TestSuite *testSuite = new TestSuite("AxisConfigTestCase");
  
      testSuite->addTest (new TestCaller <AxisConfigTestCase>
        ("testGetAxisLogPath", &AxisConfigTestCase::testGetAxisLogPath));
  
      testSuite->addTest (new TestCaller <AxisConfigTestCase>
        ("testGetWsddFilePath", &AxisConfigTestCase::testGetWsddFilePath));
  
  
      return testSuite;
  }
  
  void AxisConfigTestCase::testGetWsddFilePath()
  {
      char* ExpectedWsddLogPath ="Axis\\conf\\server.wsdd";
      char* WsddLogPath;
      WsddLogPath = pAxisConfig->GetWsddFilePath();
  
  
      string sResult = WsddLogPath;
      string ExpectedResult = ExpectedWsddLogPath;
  
      CPPUNIT_ASSERT_EQUAL(ExpectedResult,sResult);
  
  }
  
  
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisConfigTestCase.h
  
  Index: AxisConfigTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #if !defined(AXIS_AXISCONFIGTESTCASE_H__OF_AXIS_INCLUDED_)
  #define AXIS_AXISCONFIGTESTCASE_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include <list>
  #include "axis\common\AxisConfig.h"
  
  using namespace CppUnit;
  using namespace std;
  
  
  
  class AxisConfigTestCase  : public TestCase
  {
  private:
      AxisConfig* pAxisConfig;
  public:
      void testGetWsddFilePath();
      void testGetAxisLogPath();
      void tearDown();
      void setUp();
      
      AxisConfigTestCase();
  
      AxisConfigTestCase(string sName) : TestCase(sName) {}
      
      virtual ~AxisConfigTestCase();
      static Test* suite();
  };
  
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisSocketUtilsTestCase.cpp
  
  Index: AxisSocketUtilsTestCase.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.
   */
  
  /* AxisSocketUtilsTestCase1.cpp: implementation of the AxisSocketUtilsTestCase
   * class. 
   */
  
  #include "axis/test_cases/cppunit/common/AxisSocketUtilsTestCase.h"
  
  
  AxisSocketUtilsTestCase::AxisSocketUtilsTestCase()
  {
  
  }
  
  AxisSocketUtilsTestCase::~AxisSocketUtilsTestCase()
  {
  
  }
  
  void AxisSocketUtilsTestCase::setUp()
  {
      pAxisSocketUtils = new AxisSocketUtils();
  }
  
  void AxisSocketUtilsTestCase::TearDown()
  {
      delete pAxisSocketUtils;
      pAxisSocketUtils = NULL;
  }
  
  void AxisSocketUtilsTestCase::testprintSocketErrorDescription()
  {
      int ExpectedSocketError =0 ;
      
      static int SocketError = pAxisSocketUtils->printSocketErrorDescription();
  
      int SockError = SocketError;
  
      CPPUNIT_ASSERT_EQUAL(ExpectedSocketError,SockError);
      
  }
  
  
  
  Test* AxisSocketUtilsTestCase::suite()
  {
      TestSuite *testSuite = new TestSuite("AxisSocketUtilsTestCase");
  
      testSuite->addTest (new TestCaller <AxisSocketUtilsTestCase>
        ("testprintSocketErrorDescription", 
        &AxisSocketUtilsTestCase::testprintSocketErrorDescription));
  
  
      return testSuite;
  }
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisSocketUtilsTestCase.h
  
  Index: AxisSocketUtilsTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #if !defined(AXIS_AXISSOCKETUTILSTESTCASE1_H__OF_AXIS_INCLUDED_)
  #define AXIS_AXISSOCKETUTILSTESTCASE1_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include <list>
  #include "axis/common/AxisSocketUtils.h"
  
  
  using namespace CppUnit;
  using namespace std;
  
  class AxisSocketUtilsTestCase : public TestCase
  {
  private:
  
      AxisSocketUtils* pAxisSocketUtils;
  
  public:
      
      static Test* suite();
      void testprintSocketErrorDescription();
      void TearDown();
      void setUp();
      AxisSocketUtilsTestCase();
      AxisSocketUtilsTestCase(string sName) : TestCase(sName) {}
      virtual ~AxisSocketUtilsTestCase();
  
  };
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisTraceTestCase.cpp
  
  Index: AxisTraceTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #include "axis/test_cases/cppunit/common/AxisTraceTestCase.h"
  
  
  AxisTraceTestCase::AxisTraceTestCase()
  {
  
  }
  
  AxisTraceTestCase::~AxisTraceTestCase()
  {
  
  }
  
  void AxisTraceTestCase::setUp()
  {
      pAxisTrace = new AxisTrace();
  
  }
  
  void AxisTraceTestCase::tearDown()
  {
      delete pAxisTrace;
      pAxisTrace = NULL;
  }
  
  
  void AxisTraceTestCase::testTraceOne()
  {
      int ExpectedInt = 0;
  
      const char* s1 = "MyTestString";
  
      int iResult;
  
      iResult = pAxisTrace->trace(s1);
  
      CPPUNIT_ASSERT_EQUAL(ExpectedInt,iResult);
  
  }
  
  Test* AxisTraceTestCase::suite()
  {
      TestSuite *testSuite = new TestSuite("AxisTraceTestCase");
  
      testSuite->addTest (new TestCaller <AxisTraceTestCase>
        ("testTraceOne", &AxisTraceTestCase::testTraceOne));
  
      return testSuite;
  
  }
  
  
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisTraceTestCase.h
  
  Index: AxisTraceTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #if !defined(AXIS_AXISTRACETESTCASE_H__OF_AXIS_INCLUDED_)
  #define AXIS_AXISTRACETESTCASE_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include <list>
  #include "axis/common/AxisTrace.h"
  
  using namespace CppUnit;
  using namespace std;
  
  class AxisTraceTestCase  : public TestCase
  {
  private:
      AxisTrace* pAxisTrace;
  
  public:
      static Test* suite();
      void testTraceOne();
      void tearDown();
      void setUp();
      AxisTraceTestCase();
      virtual ~AxisTraceTestCase();
  
  };
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisUtilsTestCase.cpp
  
  Index: AxisUtilsTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #include "axis/test_cases/cppunit/common/AxisUtilsTestCase.h"
  
  
  AxisUtilsTestCase::AxisUtilsTestCase()
  {
  
  }
  
  AxisUtilsTestCase::~AxisUtilsTestCase()
  {
  
  }
  
  Test* AxisUtilsTestCase::suite()
  {
      TestSuite *testSuite = new TestSuite("AxisUtilsTestCase");
  
      testSuite->addTest (new TestCaller <AxisUtilsTestCase>
        ("testClearArray", &AxisUtilsTestCase::testClearArray));
  
      testSuite->addTest (new TestCaller <AxisUtilsTestCase>
        ("testIsCharacterAvailable", 
        &AxisUtilsTestCase::testIsCharacterAvailable));
  
  
      testSuite->addTest (new TestCaller <AxisUtilsTestCase>
        ("isCharacterAvailableref", 
        &AxisUtilsTestCase::isCharacterAvailableref));
  
  
      testSuite->addTest (new TestCaller <AxisUtilsTestCase>
        ("testToAxisXMLCh", &AxisUtilsTestCase::testToAxisXMLCh));
  
      testSuite->addTest (new TestCaller <AxisUtilsTestCase>
        ("testtoLowerCase", &AxisUtilsTestCase::testtoLowerCase));
  
      /* testSuite->addTest (new TestCaller <AxisUtilsTestCase>
       *  ("testLowerCaseString", &AxisUtilsTestCase::testLowerCaseString));
       */
  
      return testSuite;    
  }
  
  void AxisUtilsTestCase::testClearArray()
  {
      int iLenght = 0;
      int iExpectedLenght = 0;
      char testArr[10] = "test line";
      AxisUtils::clearArray(testArr, 10);
  
      iLenght = strlen(testArr);
  
      CPPUNIT_ASSERT_EQUAL(iExpectedLenght, iLenght);
  }
  
  void AxisUtilsTestCase::testIsCharacterAvailable()
  {
      bool bResult = false;
      bool bExpectedResult = true;
  
      bResult = AxisUtils::isCharacterAvailable("test line", 's');
  
      CPPUNIT_ASSERT_EQUAL(bExpectedResult, bResult);
  
      bResult = false;
      bExpectedResult = false;
  
      bResult = AxisUtils::isCharacterAvailable("test line", 'r');
  
      CPPUNIT_ASSERT_EQUAL(bExpectedResult, bResult);
  }
  
  void AxisUtilsTestCase::isCharacterAvailableref()
  {
  
      bool bResult = false;
      bool bExpectedResult = true;
      string myString = "MyTestString";
  
      bResult = AxisUtils::isCharacterAvailable(myString, 'S');
  
      CPPUNIT_ASSERT_EQUAL(bExpectedResult, bResult);
  }
  
  
  void AxisUtilsTestCase::testToAxisXMLCh()
  {
      const AxisChar* myString = "MyTestString";
      const AxisChar* cResult;
  
  
      cResult = AxisUtils::ToAxisXMLCh(myString);
  
      string ExpectedString = "MyTestString";
      string actualString = cResult;
  
      CPPUNIT_ASSERT_EQUAL(ExpectedString, actualString);
  }
  
  void AxisUtilsTestCase::testtoLowerCase()
  {
      const char* myString = "MyTestString";
  
      char* ExpectedString = NULL;
      char* sResult;
  
  
      sResult = AxisUtils::toLowerCase(myString);
  
       CPPUNIT_ASSERT_EQUAL(ExpectedString, sResult); 
  }
  
  
  
  
  
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/AxisUtilsTestCase.h
  
  Index: AxisUtilsTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #if !defined(AXIS_AXISUTILSTESTCASE_H__OF_AXIS_INCLUDED_)
  #define AXIS_AXISUTILSTESTCASE_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include "axis\common\AxisUtils.h"
  #include "axis\common\IArrayBean.h"
  #include "axis\common\IParam.h"
  #include "axis\common\BasicTypeSerializer.h"
  
  #include <list>
  
  
  using namespace CppUnit;
  using namespace std;
  
  class AxisUtilsTestCase : public TestCase
  {
  public:
      void testLowerCaseString();
      void testtoLowerCase();
      void testToAxisXMLCh();
      void isCharacterAvailableref();
      void testIsCharacterAvailable();
      static Test* suite();
      void testClearArray();
      AxisUtilsTestCase();
      AxisUtilsTestCase(string sName): TestCase(sName) {}
      virtual ~AxisUtilsTestCase();
  };
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/BasicTypeSerializerTestCase.cpp
  
  Index: BasicTypeSerializerTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  
  #include "axis/test_cases/cppunit/common/BasicTypeSerializerTestCase.h"
  
  
  BasicTypeSerializerTest::BasicTypeSerializerTest()
  {
  
  } 
  
  BasicTypeSerializerTest::~BasicTypeSerializerTest()
  {
  
  }
  
  void BasicTypeSerializerTest::setUp()
  {
      pBasicTypeSerializer = new BasicTypeSerializer();
  }
  
  
  void BasicTypeSerializerTest::tearDown()
  {
      delete pBasicTypeSerializer;
      pBasicTypeSerializer= NULL;
  }
  
  
  /*      To test Serialize() Method     */
  
  /*void BasicTypeSerializerTest::testSerialize()
  {
      const char* ExpectedmyChar  = "<mystring xsi:type=\"xsd:string\">mystring\
      </mystring>";
      const char* myChar = "mystring";
      const char*  myCharRes;
      
      myCharRes = pBasicTypeSerializer->serialize(myChar, 1 , XSD_STRING);
  
      string sActual = myCharRes;
      string sExpectedResult = ExpectedmyChar;
      
      CPPUNIT_ASSERT_EQUAL(sExpectedResult,sActual);    
  
  }*/
  
  
  /*     The BasicTypeSerializer Suite()     */
  
  Test* BasicTypeSerializerTest::suite()
  {
      TestSuite *testSuite = new TestSuite("BasicTypeSerializerTest");
  
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testBasicTypeStr", &BasicTypeSerializerTest::testBasicTypeStr));
  
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testEncodeToBase64Binary", 
        &BasicTypeSerializerTest::testEncodeToBase64Binary));
  
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testEncodeToHexBinary", 
        &BasicTypeSerializerTest::testEncodeToHexBinary));
  
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testGetEntityReference",
        &BasicTypeSerializerTest::testGetEntityReference));
      
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testSerializeAsAttribute",
        &BasicTypeSerializerTest::testSerializeAsAttribute));
      
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testSerializeAsElement",
        &BasicTypeSerializerTest::testSerializeAsElement));
  
  
  /*    testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testSerializeLong", &BasicTypeSerializerTest::testSerializeLong));
  
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testSerializeUnsignedLong", 
        &BasicTypeSerializerTest::testSerializeUnsignedLong));
  
      
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testSerializeFloat", &BasicTypeSerializerTest::testSerializeFloat));
  
      testSuite->addTest (new TestCaller <BasicTypeSerializerTest>
        ("testSerializeDouble", &BasicTypeSerializerTest::testSerializeDouble));
  */
  
      return testSuite;
  }
  
  
  
  void BasicTypeSerializerTest::testBasicTypeStr()
  {
      const AxisChar* ExpectedString = "string";
      const AxisChar* sResult;
  
      /* xsd__hexBinary t; */
  
      sResult = pBasicTypeSerializer->BasicTypeStr(XSD_STRING);
  
      string ExpectedString1 = ExpectedString;
      string ResultString    = sResult;
  
      CPPUNIT_ASSERT_EQUAL(ExpectedString1, ResultString);
  
  }
  
  void BasicTypeSerializerTest::testEncodeToBase64Binary()
  {
      
    xsd__base64Binary*  objXSD ;
   
    const AxisChar* cResult;
  
      
      /* objXSD->__ptr = (xsd__unsignedByte*)200;
       * objXSD->__size= 14;
       */
  
      cResult = pBasicTypeSerializer->EncodeToBase64Binary(objXSD);
  
      string sResult = cResult;
      string ExpectedString = "";
  
      CPPUNIT_ASSERT_EQUAL(sResult, ExpectedString);
  
  }
  
  
  
  void BasicTypeSerializerTest::testEncodeToHexBinary()
  {
      xsd__hexBinary* objHexBinary;
  
      const AxisChar* cResult;
  
      
      /* objXSD->__ptr = (xsd__unsignedByte*)200;
       *  objXSD->__size= 14;
       */
  
      cResult = pBasicTypeSerializer->EncodeToHexBinary(objHexBinary);
  
      string sResult = cResult;
      string ExpectedString = "";
  
      CPPUNIT_ASSERT_EQUAL(sResult, ExpectedString);
  
  }
  
  
  void BasicTypeSerializerTest::testGetEntityReference()
  {
      AxisString sAxisString;
      AxisString sResult;
  
      sAxisString = "MyTestString";
  
      sResult = pBasicTypeSerializer->GetEntityReferenced(sAxisString);
  
      string expectedString = "MyTestString";
      string actualString = sResult;
  
      CPPUNIT_ASSERT_EQUAL(expectedString, actualString);
  
  }
  
  void BasicTypeSerializerTest::testSerializeAsAttribute()
  {
      const AxisChar* cResult;
  
      const AxisChar* pPtr ="TestBool";
      const AxisChar* pPrefix ="XSD";
  
      xsd__boolean x = true_;
  
      void* pVal = &x;
  
      
      cResult = pBasicTypeSerializer->SerializeAsAttribute(pPtr,pPrefix, pVal, 
          XSD_BOOLEAN);
  
      string ExpectedString=" XSD:TestBool=\"true\"";
      string sResult = cResult;
      /* string ExpectedString = cResult; */
  
      CPPUNIT_ASSERT_EQUAL(ExpectedString, sResult);
  }
  
  
  void BasicTypeSerializerTest::testSerializeAsElement()
  {
      const AxisChar* cResult;
  
      const AxisChar* pPtr = "TestBool";
      
      
      xsd__boolean x = true_;
      void* pVal = &x;
  
      cResult = pBasicTypeSerializer->SerializeAsElement(pPtr,pVal, XSD_BOOLEAN);
  
      string ExpectedString = "<TestBool>true</TestBool>";
      string sResult = cResult;
  
      CPPUNIT_ASSERT_EQUAL(ExpectedString, sResult);
  
  }
  
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/BasicTypeSerializerTestCase.h
  
  Index: BasicTypeSerializerTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  
  #if !defined(AXIS_BASICTYPESERIALIZERTEST_H__OF_AXIS_INCLUDED_)
  #define AXIS_BASICTYPESERIALIZERTEST_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include "axis\common\AxisConfig.h"
  #include "axis\common\BasicTypeSerializer.h"
  
  using namespace CppUnit;
  using namespace std;
  
  class BasicTypeSerializerTest :public TestCase
  {
  private:
      BasicTypeSerializer* pBasicTypeSerializer;
  public:
      void testSerializeAsElement();
      void testSerializeAsAttribute();
      void testGetEntityReference();
      void testEncodeToHexBinary();
      
      void testEncodeToBase64Binary();
      void  testBasicTypeStr();
          
      void tearDown();
      void setUp();
      
      BasicTypeSerializerTest();
      virtual ~BasicTypeSerializerTest();
      static Test* suite();
  
  };
  
  #endif
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/MainFile.cpp
  
  Index: MainFile.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  
  #include "cppunit\ui\text\TestRunner.h"
  /* #include "ParamTestCase.h" */
  #include "axis/test_cases/cppunit/common/MessageDataTestCase.h"
  
  
  using namespace CppUnit::TextUi;
  
  int main(int argc, char* argv[])
  {
  
      TestRunner runner;
  
      /* runner.addTest(ArrayBeanTestCase::suite()); 
       * runner.run("ArrayBeanTestCase");
       */
  
  /*    Runner for MessageDataTestCase    */
  
      runner.addTest(MessageDataTestCase::suite());
      runner.run("MessageDataTestCase");
      
  /*
      runner.addTest(TypeMappingTestCase::suite());
      runner.run("TypeMappingTestCase");
  
  
      runner.addTest(AxisUtilsTestCase::suite());
      runner.run("AxisUtilsTestCase");
  
  ////////////// Runner for AxisArrayBeanTest //////////////////
      runner.addTest(ArrayBeanTestCase::suite());
      runner.run("ArrayBeanTestCase");
  
  
  ///////////// Runner for AxisConfigTestCase  /////////////////
      runner.addTest(AxisConfigTestCase::suite());
      runner.run("AxisConfigTestCase");
  
  /////////////  OK Runner for BasicTypeSerializer ////////////////
  
      runner.addTest(BasicTypeSerializerTest::suite());
      runner.run("BasicTypeSerializerTest");
  
  ///////////// Runner for AxisSocketUtilsTestCase /////////////
      runner.addTest(AxisSocketUtilsTestCase::suite());
      runner.run("AxisSocketUtilsTestCase");
      
  ////////////// OK Runner for ParamTestCase /////////////////
  
      runner.addTest(ParamTestCase::suite());
      runner.run("ParamTestCase");
  */
  
      return 0;
  }
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/TypeMappingTestCase.cpp
  
  Index: TypeMappingTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  
  #include "axis/test_cases/cppunit/common/TypeMappingTestCase.h"
  
  
  TypeMappingTestCase::TypeMappingTestCase()
  {
  
  }
  
  TypeMappingTestCase::~TypeMappingTestCase()
  {
  
  }
  
  void TypeMappingTestCase::setUp()
  {
      pTypeMapping = new TypeMapping();
  
  }
  
  void TypeMappingTestCase::tearDown()
  {
      delete pTypeMapping;
      pTypeMapping = NULL;
  }
  
  
  
  
  Test* TypeMappingTestCase::suite()
  {
      TestSuite *testSuite = new TestSuite("TypeMappingTestCase");
  
      testSuite->addTest (new TestCaller <TypeMappingTestCase>
        ("testMap", &TypeMappingTestCase::testMap));
  
  
      return testSuite;
  
  
  }
  
  void TypeMappingTestCase::testMap()
  {
      XSDTYPE ExpectedType=XSD_UNKNOWN;
      const AxisXMLCh* myChar = "TestString";
  
  
      XSDTYPE xResult;
  
      xResult = pTypeMapping->Map(myChar);
  
  
  
      int x =  ExpectedType;
      int y =  xResult;
  
      CPPUNIT_ASSERT_EQUAL(x,y);
  
  
  
  
  }
  
  
  
  1.1                  ws-axis/c/tests/unit_tests/cppunit/common/TypeMappingTestCase.h
  
  Index: TypeMappingTestCase.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 Thushantha De Alwis (thushantha@beyondm.net  ravi@opensource.lk)
   *
   */
  
  #if !defined(AXIS_TYPEMAPPINGTESTCASE_H__OF_AXIS_INCLUDED_)
  #define AXIS_TYPEMAPPINGTESTCASE_H__OF_AXIS_INCLUDED_
  
  #include "cppunit\TestCase.h"
  #include "cppunit\TestSuite.h"
  #include "cppunit\TestCaller.h"
  #include <string>
  #include "axis\common\TypeMapping.h"
  
  using namespace CppUnit;
  using namespace std;
  
  class TypeMappingTestCase: public TestCase
  {
  private:
      TypeMapping* pTypeMapping;
  public:
      void testMap();
      static Test* suite();
      void tearDown();
      void setUp();
      TypeMappingTestCase();
      virtual ~TypeMappingTestCase();
  
  };
  
  #endif