(file) Return to ProviderName.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / tests / ProviderName

File: [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / tests / ProviderName / ProviderName.cpp (download)
Revision: 1.1, Wed Apr 26 11:56:01 2006 UTC (18 years, 2 months ago) by vageesh.umesh
Branch: MAIN
CVS Tags: TASK_BUG_5314_IPC_REFACTORING_ROOT, TASK_BUG_5314_IPC_REFACTORING_BRANCH, TASK_BUG_5314_IPC_REFACTORING-V1, TASK_BUG_5191_QUEUE_CONSOLIDATION_ROOT, TASK_BUG_5191_QUEUE_CONSOLIDATION_BRANCH, TASK-TASK-BUG4011_WinLocalConnect-branch-New-root, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_to_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_from_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_to_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_from_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-branch, TASK-PEP291_IPV6-root, TASK-PEP291_IPV6-branch, TASK-PEP286_PRIVILEGE_SEPARATION-root, TASK-PEP286_PRIVILEGE_SEPARATION-branch, TASK-PEP274_dacim-root, TASK-PEP274_dacim-merged_out_to_branch, TASK-PEP274_dacim-merged_out_from_trunk, TASK-PEP274_dacim-merged_in_to_trunk, TASK-PEP274_dacim-merged_in_from_branch, TASK-PEP274_dacim-branch, TASK-PEP268_SSLClientCertificatePropagation-root, TASK-PEP268_SSLClientCertificatePropagation-merged_out_to_branch, TASK-PEP268_SSLClientCertificatePropagation-merged_out_from_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_to_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_from_branch, TASK-PEP268_SSLClientCertificatePropagation-branch, TASK-PEP267_SLPReregistrationSupport-root, TASK-PEP267_SLPReregistrationSupport-merging_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merging_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merged_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_to_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_from_branch, TASK-PEP267_SLPReregistrationSupport-branch, TASK-PEP241_OpenPegasusStressTests-merged_in_to_trunk, TASK-Bugs5690_3913_RemoteCMPI-root, TASK-Bugs5690_3913_RemoteCMPI-merged_out_to_branch, TASK-Bugs5690_3913_RemoteCMPI-merged_out_from_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_to_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_from_branch, TASK-Bugs5690_3913_RemoteCMPI-branch, TASK-Bug2102_RCMPIWindows-root, TASK-Bug2102_RCMPIWindows-merged_out_to_branch, TASK-Bug2102_RCMPIWindows-merged_out_from_trunk, TASK-Bug2102_RCMPIWindows-merged_in_to_trunk, TASK-Bug2102_RCMPIWindows-merged_in_from_branch, TASK-Bug2102_RCMPIWindows-branch, TASK-Bug2102Final-root, TASK-Bug2102Final-merged_out_to_branch, TASK-Bug2102Final-merged_out_from_trunk, TASK-Bug2102Final-merged_in_to_trunk, TASK-Bug2102Final-merged_in_from_branch, TASK-Bug2102Final-branch, TASK-Bug2021_RemoteCMPIonWindows-root, TASK-Bug2021_RemoteCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RemoteCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RemoteCMPIonWindows-branch, TASK-Bug2021_RCMPIonWindows-root, TASK-Bug2021_RCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RCMPIonWindows-branch, TASK-BUG7240-root, TASK-BUG7240-branch, TASK-BUG4011_WinLocalConnect-root, TASK-BUG4011_WinLocalConnect-merged_out_to_branch, TASK-BUG4011_WinLocalConnect-merged_out_from_trunk, TASK-BUG4011_WinLocalConnect-merged_in_to_trunk, TASK-BUG4011_WinLocalConnect-merged_in_from_branch, TASK-BUG4011_WinLocalConnect-branch-New, TASK-BUG4011_WinLocalConnect-branch, RELEASE_2_6_3-RC2, RELEASE_2_6_3-RC1, RELEASE_2_6_3, RELEASE_2_6_2-RC1, RELEASE_2_6_2, RELEASE_2_6_1-RC1, RELEASE_2_6_1, RELEASE_2_6_0-RC1, RELEASE_2_6_0-FC, RELEASE_2_6_0, RELEASE_2_6-root, RELEASE_2_6-branch-clean, RELEASE_2_6-branch, PEP286_PRIVILEGE_SEPARATION_ROOT, PEP286_PRIVILEGE_SEPARATION_CODE_FREEZE, PEP286_PRIVILEGE_SEPARATION_BRANCH, PEP286_PRIVILEGE_SEPARATION_1
BUG#: 4972
TITLE: Code Coverage : ProviderName.cpp

DESCRIPTION: Committed as approved

//%2006////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; Symantec Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Vageesh Umesh (vagumesh@in.ibm.com)
//
//%/////////////////////////////////////////////////////////////////////////////

/**
    This file has testcases that are added to cover the functions in
    Pegasus/ProviderManager2/ProviderName.cpp.
*/

#include <Pegasus/ProviderManager2/ProviderName.h>
#include <Pegasus/Common/PegasusAssert.h>

PEGASUS_USING_PEGASUS;
PEGASUS_USING_STD;

static char * verbose;

void test01()
{
    /**
        Added to cover the Function ProviderName::ProviderName(void);
    */
    ProviderName pn;

    /**
        Added to cover the Function
        ProviderName::ProviderName(
        const CIMNamespaceName & nameSpace,const CIMName & className,
        const Uint32 capabilities,const CIMName & method)
    */
    CIMNamespaceName nsn("/root/cimv");
    CIMName classname("MyClass");
    CIMName method("MyMethod");
    ProviderName pn1(nsn,classname,1,method);

    /**
        Added to cover the Function
        ProviderName::ProviderName(
        const String & logicalName,
        const String & physicalName,
        const String & interfaceName,
        const Uint32 capabilities,
        const CIMName & method)
    */
    ProviderName pnobj("dummylogicalname", "dummyphysicalname", "dummyinterfacename", 1, method);

    /**
        Added to cover the Function
        String ProviderName::getLogicalName(void) const
    */
    String get_logical_name = pnobj.getLogicalName();
    PEGASUS_TEST_ASSERT(get_logical_name == "dummylogicalname");

    /**
        Added to cover the Function
        ProviderName::ProviderName(
        const CIMObjectPath & path,const Uint32 capabilities,const CIMName & method)
    */
    CIMObjectPath cobjpath("//localhost/root/cimv2:MyClass");
    ProviderName pn2(cobjpath,1,method);

    /**
        Added to cover the Function
        void ProviderName::setPhysicalName(const String & physicalName)
    */
    pn.setPhysicalName("PhysicalName1");
    String set_phy_name = pn.getPhysicalName();
    PEGASUS_TEST_ASSERT(set_phy_name == "PhysicalName1");

    /**
        Added to cover the Function
        String ProviderName::getInterfaceName(void) const
    */
    String get_inf_name = pn1.getInterfaceName();
    PEGASUS_TEST_ASSERT(get_inf_name == "");

    /**
        Added to cover the Functions
        void ProviderName::setLocation(const String &location)
                        AND
        String ProviderName::getLocation(void) const
    */
    pn2.setLocation("//localhost/root/dummy");
    String get_loc = pn2.getLocation();
    PEGASUS_TEST_ASSERT(get_loc == "//localhost/root/dummy");

    /**
        Added to cover the Function
        Uint32 ProviderName::getCapabilitiesMask(void) const
    */
    Uint32 get_cap = pn2.getCapabilitiesMask();
    PEGASUS_TEST_ASSERT(get_cap == 1);
    Uint32 get_cap1 = pn.getCapabilitiesMask();
    PEGASUS_TEST_ASSERT(get_cap1 == 0);

    /**
        Added to cover the Function
        CIMName ProviderName::getMethodName(void) const
    */
    CIMName get_met_name = pn1.getMethodName();
    PEGASUS_TEST_ASSERT(get_met_name.getString() == "MyMethod");

    /**
        Added to cover the Function
        CIMName ProviderName::getClassName() const
    */
    CIMName get_cl_name = pn1.getClassName();
    PEGASUS_TEST_ASSERT(get_cl_name.getString() == "MyClass");

    /**
        Added to cover the Function
        CIMNamespaceName ProviderName::getNameSpace() const
    */
    CIMNamespaceName ret_cnsn = pn1.getNameSpace();
    PEGASUS_TEST_ASSERT(ret_cnsn.getString() == "root/cimv");
}

int main(int argc, char** argv)
{
    try
    {
        test01();
    }
    catch(Exception& e)
    {
        PEGASUS_STD (cout) << "Exception: " << e.getMessage() << PEGASUS_STD(endl);
        exit(1);
    }

    PEGASUS_STD (cout) << argv[0] << " +++++ passed all tests" << PEGASUS_STD(endl);
    return 0;
}

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2