You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2004/01/28 12:45:32 UTC
cvs commit: ws-axis/c/src/test_cases/cppunit/common ArrayBeanTestCase.cpp AxisConfigTestCase.cpp AxisSocketUtilsTestCase.cpp AxisTraceTestCase.cpp AxisUtilsTestCase.cpp BasicTypeSerializerTestCase.cpp MainFile.cpp TypeMappingTestCase.cpp
roshan 2004/01/28 03:45:31
Added: c/src/test_cases/cppunit/common ArrayBeanTestCase.cpp
AxisConfigTestCase.cpp AxisSocketUtilsTestCase.cpp
AxisTraceTestCase.cpp AxisUtilsTestCase.cpp
BasicTypeSerializerTestCase.cpp MainFile.cpp
TypeMappingTestCase.cpp
Log:
These test cases were submited by Thushantha De Alwis (thushantha@beyondm.net ravi@opensource.lk)
Revision Changes Path
1.1 ws-axis/c/src/test_cases/cppunit/common/ArrayBeanTestCase.cpp
Index: ArrayBeanTestCase.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @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"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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/src/test_cases/cppunit/common/AxisConfigTestCase.cpp
Index: AxisConfigTestCase.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Thushantha De Alwis (thushantha@beyondm.net ravi@opensource.lk)
*
*/
//////////////////////////////////////////////////////////////////////
// AxisConfigTestCase3.cpp: implementation of the AxisConfigTestCase class.
//
//////////////////////////////////////////////////////////////////////
#include "axis/test_cases/cppunit/common/AxisConfigTestCase.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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/src/test_cases/cppunit/common/AxisSocketUtilsTestCase.cpp
Index: AxisSocketUtilsTestCase.cpp
===================================================================
// AxisSocketUtilsTestCase1.cpp: implementation of the AxisSocketUtilsTestCase class.
//
//////////////////////////////////////////////////////////////////////
#include "axis/test_cases/cppunit/common/AxisSocketUtilsTestCase.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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/src/test_cases/cppunit/common/AxisTraceTestCase.cpp
Index: AxisTraceTestCase.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Thushantha De Alwis (thushantha@beyondm.net ravi@opensource.lk)
*
*/
//////////////////////////////////////////////////////////////////////
// AxisTraceTestCase.cpp: implementation of the AxisTraceTestCase class.
//
//////////////////////////////////////////////////////////////////////
#include "axis/test_cases/cppunit/common/AxisTraceTestCase.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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/src/test_cases/cppunit/common/AxisUtilsTestCase.cpp
Index: AxisUtilsTestCase.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Thushantha De Alwis (thushantha@beyondm.net ravi@opensource.lk)
*
*/
//////////////////////////////////////////////////////////////////////
// AxisUtilsTestCase.cpp: implementation of the AxisUtilsTestCase class.
//
//////////////////////////////////////////////////////////////////////
#include "axis/test_cases/cppunit/common/AxisUtilsTestCase.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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/src/test_cases/cppunit/common/BasicTypeSerializerTestCase.cpp
Index: BasicTypeSerializerTestCase.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Thushantha De Alwis (thushantha@beyondm.net ravi@opensource.lk)
*
*/
//////////////////////////////////////////////////////////////////////
// BasicTypeSerializerTest.cpp: implementation of the BasicTypeSerializerTest class.
//
//////////////////////////////////////////////////////////////////////
#include "axis/test_cases/cppunit/common/BasicTypeSerializerTestCase.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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/src/test_cases/cppunit/common/MainFile.cpp
Index: MainFile.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @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/src/test_cases/cppunit/common/TypeMappingTestCase.cpp
Index: TypeMappingTestCase.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Thushantha De Alwis (thushantha@beyondm.net ravi@opensource.lk)
*
*/
//////////////////////////////////////////////////////////////////////
// TypeMappingTestCase.cpp: implementation of the TypeMappingTestCase class.
//
//////////////////////////////////////////////////////////////////////
#include "axis/test_cases/cppunit/common/TypeMappingTestCase.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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);
}