Kaydet (Commit) be66d576 authored tarafından Damjan Jovanovic's avatar Damjan Jovanovic

#i125003# migrate main/xmlsecurity/qa from cppunit to Google Test. Needs neon which is copyleft;

doesn't compile; but isn't run during the build.
üst d3600c12
......@@ -37,10 +37,7 @@
#include "com/sun/star/uno/Reference.hxx"
#include "cppuhelper/bootstrap.hxx"
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
#include "gtest/gtest.h"
#include "sal/types.h"
#include "comphelper/sequence.hxx"
#include <rtl/ustring.hxx>
......@@ -55,9 +52,9 @@ using namespace com::sun::star;
namespace {
class Test: public CppUnit::TestFixture {
class Test: public ::testing::Test {
private:
protected:
static uno::Sequence< security::CertAltNameEntry > altNames;
static bool runOnce;
......@@ -72,45 +69,14 @@ namespace {
~Test();
virtual void setUp();
virtual void SetUp();
virtual void tearDown();
void test_Others();
void test_RFC822();
void test_DNS();
void test_Direcory();
void test_URI();
void test_IP();
void test_RID();
void test_EDI();
void test_X400();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(test_Others);
CPPUNIT_TEST(test_RFC822);
CPPUNIT_TEST(test_DNS);
CPPUNIT_TEST(test_Direcory);
CPPUNIT_TEST(test_URI);
CPPUNIT_TEST(test_IP);
CPPUNIT_TEST(test_RID);
CPPUNIT_TEST(test_EDI);
CPPUNIT_TEST(test_X400);
CPPUNIT_TEST_SUITE_END();
virtual void TearDown();
};
uno::Sequence< security::CertAltNameEntry > Test::altNames;
bool Test::runOnce = false;
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
Test::Test()
{
......@@ -172,14 +138,14 @@ namespace {
}
void Test::setUp() {
void Test::SetUp() {
}
void Test::tearDown() {
void Test::TearDown() {
}
void Test::test_Others() {
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
TEST_F(Test, test_Others) {
ASSERT_NO_THROW( ASSERT_TRUE( altNames.getLength() > 0 ) );
for(int n = 1; n < altNames.getLength(); n++)
{
if (altNames[n].Type == security::ExtAltNameType_OTHER_NAME)
......@@ -187,91 +153,90 @@ namespace {
::com::sun::star::beans::NamedValue otherNameProp;
if (altNames[n].Value >>= otherNameProp)
{
CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("1.2.3.4"), otherNameProp.Name);
ASSERT_EQ( rtl::OUString::createFromAscii("1.2.3.4"), otherNameProp.Name);
uno::Sequence< sal_Int8 > ipAddress;
otherNameProp.Value >>= ipAddress;
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) );
ASSERT_NO_THROW( ASSERT_TRUE( ipAddress.getLength() > 0 ) );
}
}
}
}
void Test::test_RFC822() {
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
TEST_F(Test, test_RFC822) {
ASSERT_NO_THROW( ASSERT_TRUE( altNames.getLength() > 0 ) );
for(int n = 1; n < altNames.getLength(); n++)
{
if (altNames[n].Type == security::ExtAltNameType_RFC822_NAME)
{
rtl::OUString value;
altNames[n].Value >>= value;
CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("my@other.address"), value);
ASSERT_EQ( rtl::OUString::createFromAscii("my@other.address"), value );
}
}
}
void Test::test_DNS() {
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
TEST_F(Test, test_DNS) {
ASSERT_NO_THROW( ASSERT_TRUE( altNames.getLength() > 0 ) );
for(int n = 1; n < altNames.getLength(); n++)
{
if (altNames[n].Type == security::ExtAltNameType_DNS_NAME)
{
rtl::OUString value;
altNames[n].Value >>= value;
CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("alt.openoffice.org"), value);
ASSERT_EQ( rtl::OUString::createFromAscii("alt.openoffice.org"), value);
}
}
}
void Test::test_Direcory() {
TEST_F(Test, test_Direcory) {
// Not implemented
}
void Test::test_URI() {
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
TEST_F(Test, test_URI) {
ASSERT_NO_THROW( ASSERT_TRUE( altNames.getLength() > 0 ) );
for(int n = 1; n < altNames.getLength(); n++)
{
if (altNames[n].Type == security::ExtAltNameType_URL)
{
rtl::OUString value;
altNames[n].Value >>= value;
CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("http://my.url.here/"), value);
ASSERT_EQ( rtl::OUString::createFromAscii("http://my.url.here/"), value);
}
}
}
void Test::test_IP() {
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
TEST_F(Test, test_IP) {
ASSERT_NO_THROW( ASSERT_TRUE( altNames.getLength() > 0 ) );
for(int n = 1; n < altNames.getLength(); n++)
{
if (altNames[n].Type == security::ExtAltNameType_IP_ADDRESS)
{
uno::Sequence< sal_Int8 > ipAddress;
altNames[n].Value >>= ipAddress;
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) );
ASSERT_NO_THROW( ASSERT_TRUE( ipAddress.getLength() > 0 ) );
}
}
}
void Test::test_RID() {
CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
TEST_F(Test, test_RID) {
ASSERT_NO_THROW( ASSERT_TRUE( altNames.getLength() > 0 ) );
for(int n = 1; n < altNames.getLength(); n++)
{
if (altNames[n].Type == security::ExtAltNameType_REGISTERED_ID)
{
rtl::OUString value;
altNames[n].Value >>= value;
CPPUNIT_ASSERT( rtl::OUString::createFromAscii("1.2.3.4").equals(value));
ASSERT_TRUE( rtl::OUString::createFromAscii("1.2.3.4").equals(value));
}
}
}
void Test::test_EDI() {
TEST_F(Test, test_EDI) {
// Not implemented
}
void Test::test_X400() {
TEST_F(Test, test_X400) {
// Not implemented
}
}
CPPUNIT_PLUGIN_IMPLEMENT();
#**************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
#**************************************************************
UDK_3_0_0 {
global:
cppunitTestPlugIn;
local:
*;
};
......@@ -36,12 +36,15 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
.INCLUDE : $(PRJ)$/util$/target.pmk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
.IF "$(ENABLE_UNIT_TESTS)" != "YES"
all:
@echo unit tests are disabled. Nothing to do.
SHL1IMPLIB = i$(SHL1TARGET)
SHL1OBJS = $(SLOFILES)
SHL1RPATH = NONE
SHL1STDLIBS = $(CPPUNITLIB) \
.ELSE
APP1OBJS = $(SLO)/SanCertExt.obj
APP1RPATH = NONE
APP1STDLIBS = $(GTESTLIB) \
$(SALLIB) \
$(NEON3RDLIB) \
$(CPPULIB) \
......@@ -52,20 +55,12 @@ SHL1STDLIBS = $(CPPUNITLIB) \
$(COMPHELPERLIB) \
$(TESTLIB)
SHL1TARGET = qa_CertExt
SHL1VERSIONMAP = $(PRJ)/qa/certext/export.map
DEF1NAME = $(SHL1TARGET)
SLOFILES = $(SLO)/SanCertExt.obj
APP1TARGET = qa_CertExt
APP1TEST = enabled
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
ALLTAR : cpptest
cpptest : $(SHL1TARGETN)
CPPTEST_LIBRARY = $(SHL1TARGETN)
.END
.END
.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
.ENDIF # "$(OOO_SUBSEQUENT_TESTS)" == ""
.ENDIF # "$(ENABLE_NSS_MODULE)" == "NO"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment