コード例 #1
0
CMPIStatus TestCMPIBrokerInstanceProviderModifyInstance (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * cop,
    const CMPIInstance * ci,
    const char **properties)
{
    CMPIString* type;
    CMPIBoolean bol=0;
    CMPIStatus rc = {CMPI_RC_OK, NULL};

    PROV_LOG_OPEN (_ClassName, _ProviderLocation);
    PROV_LOG ("Inside Modify Instance");

    /* Testcases for increasing coverage in CMPI_BrokerEnc.cpp*/
    type = CDGetType (_broker, rslt, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type "
        "CMPIResult with CMPI_ResultResponseOnStack_Ftab : (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
    if ( bol )
    {
        PROV_LOG ("++++ CDIsOfType for CMPIResult with "
            "CMPI_ResultResponseOnStack_Ftab status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }
    PROV_LOG_CLOSE ();
    
    CMReturn (CMPI_RC_OK);
}
コード例 #2
0
CMPIStatus TestCMPIBrokerInstanceProviderExecQuery (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * ref,
    const char *lang,
    const char *query)
{
    CMPIData retData;
    CMPIString* type;
    CMPIBoolean bol=0;
    CMPIStatus rc = {CMPI_RC_OK, NULL};

    PROV_LOG_OPEN (_ClassName, _ProviderLocation);
    PROV_LOG ("ExecQuery");
    retData = CMGetProperty(_inst, "n64", &rc);
    PROV_LOG("++++ Status of CMGetProperty : (%s)",
        strCMPIStatus(rc));
    PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
        retData.value.uint64);

    type = CDGetType (_broker, rslt, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type "
        "CMPIResult with CMPI_ResultExecQueryOnStack_Ftab : (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
    if ( bol )
    {
        PROV_LOG ("++++ CDIsOfType for CMPIResult with "
            "CMPI_ResultExecQueryOnStack_Ftab status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }
 
    PROV_LOG_CLOSE();
    CMReturnInstance(rslt, _inst);
    CMReturnDone(rslt);
    CMReturn (CMPI_RC_OK);
}
コード例 #3
0
CMPIObjectPath *
make_ObjectPath (const CMPIBroker *broker, const char *ns, const char *clss)
{
  CMPIObjectPath *objPath = NULL;
  CMPIStatus rc = { CMPI_RC_OK, NULL };

  PROV_LOG ("--- make_ObjectPath: CMNewObjectPath");
  objPath = CMNewObjectPath (broker, ns, clss, &rc);

  PROV_LOG ("----- %s", strCMPIStatus (rc));

  return objPath;
}
コード例 #4
0
CMPIObjectPath * make_ObjectPath (
    const CMPIBroker *broker,
    const char *ns,
    const char *className)
{
    CMPIObjectPath *objPath = NULL;
    CMPIStatus rc = { CMPI_RC_OK, NULL };

    PROV_LOG ("++++  make_ObjectPath: CMNewObjectPath");
    objPath = CMNewObjectPath (broker, ns, className, &rc);

    PROV_LOG ("++++  CMNewObjectPath : (%s)", strCMPIStatus (rc));
    CMAddKey (objPath, "ElementName", (CMPIValue *) className, CMPI_chars);

    return objPath;
}
コード例 #5
0
CMPIInstance * make_Instance (const CMPIObjectPath * op)
{
    CMPIStatus rc = { CMPI_RC_OK, NULL };
    CMPIInstance *ci = NULL;

    PROV_LOG ("++++ make_Instance: CMNewInstance");
    ci = CMNewInstance (_broker, op, &rc);
    PROV_LOG ("++++  CMNewInstance : (%s)", strCMPIStatus (rc));
    if (rc.rc == CMPI_RC_ERR_NOT_FOUND)
    {
        PROV_LOG (" ---- Class %s is not found in the %s namespace!",
            _ClassName, _Namespace);
        return NULL;
    }
    return ci;
}
コード例 #6
0
CMPIData
instance_accessor ( const char *name, void *param)
{

  CMPIData data = { 0, CMPI_null, {0} };
  CMPIStatus rc = { CMPI_RC_OK, NULL };
  CMPIBroker *broker = (CMPIBroker *) param;

  PROV_LOG ("-- #4.2 instance_accessor");
  PROV_LOG ("-- Property: %s", name);
/* SELECT * FROM CIM_InstModification WHERE (SourceInstance="Boo" OR SourceInstance="Hello") AND PreviousInstance !="Hello again"]
*/
  if (strcmp ("PropertyA", name) == 0)
    {
      data.type = CMPI_string;
      data.state = CMPI_goodValue;
      data.value.string = CMNewString (broker, "AccessorPropertyA", &rc);
    }
  if (strcmp ("PropertyB", name) == 0)
    {
      data.type = CMPI_string;
      data.state = CMPI_goodValue;
      data.value.string = CMNewString (broker, "AccessorPropertyB", &rc);
    }
  if (strcmp ("n", name) == 0)
    {
      data.type = CMPI_uint64;
      data.state = CMPI_goodValue;
      data.value.uint64 = 42;
    }
  if (strcmp ("f", name) == 0)
    {
      data.type = CMPI_real64;
      data.state = CMPI_goodValue;
      data.value.real64 = 0.42;
    }
  if (strcmp ("s", name) == 0)
    {
      data.type = CMPI_string;
      data.state = CMPI_goodValue;
      data.value.string = CMNewString (broker, "s", &rc);
    }

  PROV_LOG ("----  (%s)", strCMPIStatus (rc));
  return data;
}
コード例 #7
0
CMPIStatus TestCMPIBrokerInstanceProviderGetInstance (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * cop,
    const char **properties)
{
    CMPIStatus rc = {CMPI_RC_OK, NULL};
    CMPIString* retNamespace;
    CMPIString* retClassname;
    CMPIString* type;
    CMPIData retData;
    CMPIObjectPath* obj;
    CMPIBoolean bol = 0;
    const char* str1;
    const char* str2;

    PROV_LOG_OPEN (_ClassName, _ProviderLocation);
    PROV_LOG("GetInstance");
    PROV_LOG("++++Namespace ");

    obj = CMGetObjectPath(_inst, &rc);
    PROV_LOG("++++ Status of CMGetObjectPath : (%s)",
        strCMPIStatus(rc));
    retNamespace = CMGetNameSpace(obj, &rc);
    PROV_LOG("++++ Status of CMGetNameSpace : (%s)",
        strCMPIStatus(rc));
    retClassname = CMGetClassName(obj, &rc);
    PROV_LOG("++++ Status of CMGetClassName : (%s)",
        strCMPIStatus(rc));
    str1 = CMGetCharsPtr(retNamespace, &rc);
    PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
        strCMPIStatus(rc));
    str2 = CMGetCharsPtr(retClassname, &rc);
    PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
        strCMPIStatus(rc));
    retData = CMGetProperty(_inst, "n64", &rc);
    PROV_LOG("++++ Status of CMGetProperty : (%s)",
        strCMPIStatus(rc));
    PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
        retData.value.uint64);
   
    /* Test cases for increasing coverage in CMPI_BrokerEnc.cpp*/
    type = CDGetType (_broker, rslt, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type "
        "CMPIResult with CMPI_ResultInstOnStack_Ftab : (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
    if ( bol )
    {
        PROV_LOG ("++++ CDIsOfType for CMPIResult with "
            "CMPI_ResultInstOnStack_Ftab status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }
    PROV_LOG_CLOSE();

    if (_inst)
    {
        CMReturnInstance(rslt, _inst);
        CMReturnDone(rslt);
        CMReturn (CMPI_RC_OK);
    }
    else
    {
        CMReturn (CMPI_RC_ERR_NOT_SUPPORTED);
    }
}
コード例 #8
0
CMPIStatus TestCMPIBrokerInstanceProviderCreateInstance (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * cop,
    const CMPIInstance * ci)
{
    const CMPIString* retNamespace;
    const CMPIString* retClassname;
    CMPIString* type;
    const char* str1;
    const char* str2;
    CMPIStatus rc = { CMPI_RC_OK, NULL };
    CMPIData retData;
    CMPIObjectPath *obj;
    CMPIBoolean bol = 0;

    PROV_LOG_OPEN (_ClassName, _ProviderLocation);
    PROV_LOG("CreateInstance");

    retNamespace = CMGetNameSpace(cop, &rc);
    retClassname = CMGetClassName(cop, &rc);
    str1 = CMGetCharsPtr(retNamespace, &rc);
    str2 = CMGetCharsPtr(retClassname, &rc);
    PROV_LOG("++++Obtained Namespace : (%s) Class (%s)", str1, str2);

    if(ci)
    { 
        /* Test to increase coverage in Broker_Enc.cpp*/
        type = CDToString (_broker, ci, &rc);
        PROV_LOG ("++++ Passing CMPIInstance with CMPI_InstanceOnStack_Ftab "
            "to mbEncToString successes : "
            "(%s)",
            strCMPIStatus (rc));    

        type = CDGetType (_broker, ci, &rc);
        PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIInstance"
            " : (%s) type(%s)",
            strCMPIStatus (rc),
            CMGetCharsPtr(type, NULL));

        bol = CDIsOfType (_broker, ci, "CMPIInstance", &rc);
        if ( bol )
        {
            PROV_LOG ("++++ CDIsOfType for CMPIInstance with "
                "CMPI_InstanceOnStack_Ftab status is (%s) : %d",
                strCMPIStatus (rc),
                bol);
        }

        type = CDToString (_broker, cop, &rc);
        PROV_LOG ("++++ Passing CMPIObjectPath with "
            "CMPI_ObjectPathOnStack_Ftab to mbEncToString successes : (%s)",
            strCMPIStatus (rc));    

        type = CDGetType (_broker, cop, &rc);
        PROV_LOG ("++++ Status of mbEncGetType with input of type "
            "CMPIObjectPath : (%s) type(%s)",
            strCMPIStatus (rc),
            CMGetCharsPtr(type, NULL));

        bol = CDIsOfType (_broker, cop, "CMPIObjectPath", &rc);
        if ( bol )
        {
            PROV_LOG ("++++ CDIsOfType for CMPIObjectPath with "
                "CMPI_ObjectPathOnStack_Ftab status is (%s) : %d",
                strCMPIStatus (rc),
                bol);
        }

        type = CDGetType (_broker, rslt, &rc);
        PROV_LOG ("++++ Status of mbEncGetType with input of type "
            "CMPIResult with CMPI_ResultRefOnStack_Ftab : (%s) type(%s)",
            strCMPIStatus (rc),
            CMGetCharsPtr(type, NULL));

        bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
        if ( bol )
        {
            PROV_LOG ("++++ CDIsOfType for CMPIResult with "
                "CMPI_ResultRefOnStack_Ftab status is (%s) : %d",
                strCMPIStatus (rc),
                bol);
        }

        _inst = CMClone(ci, &rc);
        PROV_LOG("++++ Status of CMClone(ci) : (%s)",
            strCMPIStatus(rc));
        CMSetObjectPath (_inst, cop);
        PROV_LOG("++++ Status of CMSetObjectPath(_inst) : (%s)",
            strCMPIStatus(rc));
        _setProperty1(_inst, "*");
        retData = CMGetProperty(_inst, "n64", &rc);
        PROV_LOG("++++ Status of CMGetProperty : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
            retData.value.uint64);
        retData = CMGetProperty(_inst, "n32", &rc);
        PROV_LOG("++++ Status of CMGetProperty : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("n32 = %d", retData.value.uint32);

        obj = CMGetObjectPath(_inst, &rc);
        PROV_LOG("++++ Status of CMGetObjectPath : (%s)",
            strCMPIStatus(rc));
        retNamespace = CMGetNameSpace(obj, &rc);
        PROV_LOG("++++ Status of CMGetNameSpace : (%s)",
            strCMPIStatus(rc));
        retClassname = CMGetClassName(obj, &rc);
        PROV_LOG("++++ Status of CMGetClassName : (%s)",
            strCMPIStatus(rc));
        str1 = CMGetCharsPtr(retNamespace, &rc);
        PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
            strCMPIStatus(rc));
        str2 = CMGetCharsPtr(retClassname, &rc);
        PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("++++Namespace (_inst): (%s) Class (*%s)", str1, str2);
        retData = CMGetProperty(_inst, "n64", &rc);
        PROV_LOG("++++ Status of CMGetProperty : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
            retData.value.uint64);
        PROV_LOG_CLOSE ();

        CMReturnObjectPath(rslt, cop);
        CMReturnDone(rslt);
        CMReturn (CMPI_RC_OK);
    }
    else
    {
        PROV_LOG_CLOSE ();
        CMReturn (CMPI_RC_ERR_NOT_SUPPORTED);
    }
}
コード例 #9
0
// To increase the coverage in CMPIBrokerEnc.cpp
static int _testBrokerEnc (const CMPIContext * ctx,
    const CMPIResult * rslt)
{
    int flag = 1 ;
    int count;
    char* msgId;
    char* illegal;
    char path[100];
    void* hdl;
    CMPIStatus rc = { CMPI_RC_OK, NULL };
    CMPIString *type;
    CMPIString *cmpiStr;
    CMPIBoolean bol=0;
    CMPIBoolean bool=0;
    CMPIArray* cmpiArray = NULL ;
    CMPIInstance* instance = NULL;
    CMPIInstance* instance1 = NULL;
    CMPIInstance* instanceErr = NULL;
    CMPIObjectPath* objPath = NULL;
    CMPIObjectPath* objPath1 = NULL;
    CMPICount cmpiCnt = 5;
    CMPIType cmpiType = CMPI_uint64;
    CMPIDateTime* cmpiDateTime = NULL ;
    CMPIMsgFileHandle msgFileHandle;
    CMPIEnumeration* cmpiEnum;
    CMPISelectExp* selExp;
    CMPIValue val;
    CMPIError* err;
    CMPIStatus* rc1 = NULL;
    CMPIArgs* args = NULL;
    void* handle;
    CMPIInstanceFT* funcTable;

    PROV_LOG ("++++ _testBrokerEnc ");

    PROV_LOG ("++++ ObjectPath testing");

    objPath1 = CMNewObjectPath (_broker, NULL, _ClassName, &rc);
    PROV_LOG ("++++ New object path with NULL namespace creation : (%s)",
        strCMPIStatus (rc));
    CMRelease(objPath1);

    objPath1 = CMNewObjectPath (_broker, _Namespace, "abc", &rc);
    PROV_LOG ("++++ New object path with wrong classname : (%s)",
        strCMPIStatus (rc));

    instance = CMNewInstance(_broker, NULL, &rc);
    PROV_LOG ("++++ New Instance with NULL object path : (%s)",
        strCMPIStatus (rc));

    handle = objPath1->hdl;
    objPath1->hdl=NULL;
    instance = CMNewInstance(_broker, objPath1, &rc);
    PROV_LOG ("++++ New Instance with object path handle set to NULL: (%s)",
        strCMPIStatus (rc));
    objPath1->hdl = handle;

    objPath = make_ObjectPath(_broker, _Namespace, _ClassName);
    instance = CMNewInstance(_broker, objPath, &rc);
    PROV_LOG ("++++ New Instance creation status: (%s)",
        strCMPIStatus (rc));
    instance1 = CMClone(instance, &rc);
    instanceErr = CMClone(instance, &rc);

    cmpiStr = CMNewString(_broker, NULL, &rc);
    PROV_LOG ("++++ Status of mbNewString with NULL parameter:(%s)",
        strCMPIStatus (rc));

    err = CMNewCMPIError(_broker, "abc", "abc", "abc", 4, 5, 6, rc1);
    if (err)
    {
        PROV_LOG ("++++ CMNewCMPIError called with null rc");
    }
    cmpiDateTime = CMNewDateTimeFromChars(_broker, "datetime", &rc);
    PROV_LOG ("++++ Status of CMNewDateTimeFromChars with junk parameter:(%s)",
        strCMPIStatus (rc));

    if (!CMClassPathIsA(_broker, NULL, NULL, &rc))
    {
        PROV_LOG ("++++ Error Status of CMClassPathIsA:(%s)",
            strCMPIStatus (rc));
    }

    if (!CMClassPathIsA(_broker, objPath, NULL, &rc))
    {
        PROV_LOG ("++++ Error Status of CMClassPathIsA:(%s)",
            strCMPIStatus (rc));
    }
    illegal = "$";
    if (!CMClassPathIsA(_broker, objPath, illegal, &rc))
    {
        PROV_LOG ("++++ Error Status of CMClassPathIsA:(%s)",
            strCMPIStatus (rc));
    }


    rc = CMLogMessage(_broker,
        2,
        "TestProvider",
        "Testing Severity 2 in TestCMPIBrokerEnc",
        NULL);
    PROV_LOG ("++++ Status of CMLogMessage with Severity 2:(%s)",
        strCMPIStatus (rc));

    rc = CMLogMessage(_broker,
        3,
        "TestProvider",
        "Testing Severity 3 in TestCMPIBrokerEnc",
        NULL);
    PROV_LOG ("++++ Status of CMLogMessage with Severity 3:(%s)",
        strCMPIStatus (rc));

    rc = CMLogMessage(_broker,
        4,
        "TestProvider",
        "Testing Severity 4 in TestCMPIBrokerEnc",
        NULL);
    PROV_LOG ("++++ Status of CMLogMessage with Severity 4:(%s)",
        strCMPIStatus (rc));

    rc = CMTraceMessage(_broker,
        2,
        "CMPIProvider",
        "Tracing for level 2",
        NULL);
    PROV_LOG ("++++ Status of CMTraceMessage with level 2:(%s)",
        strCMPIStatus (rc));

    rc = CMTraceMessage(_broker,
        3,
        "CMPIProvider",
        "Tracing for level 3",
        NULL);
    PROV_LOG ("++++ Status of CMTraceMessage with level 3:(%s)",
        strCMPIStatus (rc));

    rc = CMTraceMessage(_broker,
        4,
        "CMPIProvider",
        "Tracing for level 4",
        NULL);
    PROV_LOG ("++++ Status of CMTraceMessage with level 4:(%s)",
        strCMPIStatus (rc));

    cmpiStr = CMNewString(_broker, "Tracing for level 5", &rc);
    rc = CMTraceMessage(_broker,
        5,
        "CMPIProvider",
        NULL,
        cmpiStr);
    PROV_LOG ("++++ Status of CMTraceMessage with level 5:(%s)",
        strCMPIStatus (rc));
    CMRelease(cmpiStr);

    PROV_LOG ("++++ Calling mbEncToString function ");

    type = CDToString (_broker, _broker, &rc);
    PROV_LOG ("++++ Error status of mbEncToString with wrong object path:"
        " (%s)",
        strCMPIStatus (rc));

    type = CDToString (_broker, NULL, &rc);
    PROV_LOG ("++++ Error status of mbEncToString with NULL parameter:"
        " (%s)",
        strCMPIStatus (rc));

    type = CDToString (_broker, type, &rc);
    PROV_LOG ("++++ Passing CMPIString to mbEncToString successes : (%s)",
        strCMPIStatus (rc));

    type = CDToString (_broker, objPath, &rc);
    PROV_LOG ("++++ Passing CMPIObjectPath to mbEncToString successes : (%s)",
        strCMPIStatus (rc));
    handle = objPath1->hdl;
    objPath1->hdl = NULL;
    type = CDToString (_broker, objPath1, &rc);
    if ( rc.rc == CMPI_RC_ERR_INVALID_PARAMETER)
    {
        PROV_LOG ("++++ Error status of mbEncToString with object path with "
            "NULL handle: (%s)",
            strCMPIStatus (rc));
    }
    objPath1->hdl = handle;

    val.boolean = 1;
    rc = CMSetProperty (instance, "Boolean", &val, CMPI_boolean);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_boolean : (%s)",
        strCMPIStatus (rc));

    val.uint8 = 8;
    rc = CMSetProperty (instance, "Uint8", &val, CMPI_uint8);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_uint8 : (%s)",
        strCMPIStatus (rc));

    val.uint16 = 16;
    rc = CMSetProperty (instance, "Uint16", &val, CMPI_uint16);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_uint16 : (%s)",
        strCMPIStatus (rc));

    val.uint32 = 32;
    rc = CMSetProperty (instance, "Uint32", &val, CMPI_uint32);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_uint32 : (%s)",
        strCMPIStatus (rc));

    val.uint64 = 64;
    rc = CMSetProperty (instance, "Uint64", &val, CMPI_uint64);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_uint64 : (%s)",
        strCMPIStatus (rc));

    val.sint8 = -8;
    rc = CMSetProperty (instance, "Sint8", &val, CMPI_sint8);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_sint8 : (%s)",
        strCMPIStatus (rc));

    val.sint16 = -16;
    rc = CMSetProperty (instance, "Sint16", &val, CMPI_sint16);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_sint16 : (%s)",
        strCMPIStatus (rc));

    val.sint32 = -32;
    rc = CMSetProperty (instance, "Sint32", &val, CMPI_sint32);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_sint32 : (%s)",
        strCMPIStatus (rc));

    val.sint64 = -64;
    rc = CMSetProperty (instance, "Sint64", &val, CMPI_sint64);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_sint64 : (%s)",
        strCMPIStatus (rc));

    val.real32 = 32.32;
    rc = CMSetProperty (instance, "Real32", &val, CMPI_real32);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_real32 : (%s)",
        strCMPIStatus (rc));

    val.real64 = 64.64;
    rc = CMSetProperty (instance, "Real64", &val, CMPI_real64);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_real64 : (%s)",
        strCMPIStatus (rc));

    val.char16 = 'c';
    rc = CMSetProperty (instance, "Char16", &val, CMPI_char16);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_char16 : (%s)",
        strCMPIStatus (rc));

    cmpiDateTime = CMNewDateTime (_broker, &rc);
    val.dateTime = cmpiDateTime;
    rc = CMSetProperty (instance, "DateTime", &val, CMPI_dateTime);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_dateTime : (%s)",
        strCMPIStatus (rc));

    val.ref = objPath;
    rc = CMSetProperty (instance, "Ref", &val, CMPI_ref);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_ref : (%s)",
        strCMPIStatus (rc));

    val.inst = instance1;
    rc = CMSetProperty (instance, "Instance", &val, CMPI_instance);
    PROV_LOG ("++++ Status of CMSetProperty of type CMPI_instance : (%s)",
        strCMPIStatus (rc));

    type = CDToString (_broker, instance, &rc);
    PROV_LOG ("++++ Passing CMPIInstance to mbEncToString successes : (%s)",
        strCMPIStatus (rc));

    args = CMNewArgs(_broker, &rc);
    PROV_LOG ("++++ Status of CMNewArgs : (%s)", strCMPIStatus (rc));
    type = CDToString (_broker, args, &rc);
    PROV_LOG ("++++ Passing CMPIArgs to mbEncToString successes : (%s)",
        strCMPIStatus (rc));

    PROV_LOG ("++++ Calling mbEncGetType function  ");
    rc1 = NULL;
    type = CDGetType (_broker, NULL, rc1);
    if (!type)
    {
        PROV_LOG ("++++ Error calling mbEncGetType with NULL rc");
    }

    rc1 = NULL;
    funcTable = instanceErr->ft;
    instanceErr->ft = NULL;
    type = CDGetType (_broker, instanceErr, rc1);
    if (!type)
    {
        PROV_LOG ("++++ Error calling mbEncGetType with wrong parameter and"
            " NULL rc");
    }
    type = CDGetType (_broker, instanceErr, &rc);
    PROV_LOG ("++++ Error status of mbEncGetType with wrong input : (%s)",
        strCMPIStatus (rc));

    instanceErr->ft = funcTable;

    type = CDGetType (_broker, NULL, &rc);
    PROV_LOG ("++++ Error status of mbEncGetType with NULL input : (%s)",
        strCMPIStatus (rc));

    type = CDGetType (_broker, instance, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIInstance"
        " : (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CDGetType (_broker, objPath, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIObjectPath:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    cmpiStr = CMNewString(_broker, "Test1", & rc);
    type = CDGetType (_broker, cmpiStr, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIString:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CDGetType (_broker, _broker, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIBroker:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    cmpiArray = CMNewArray(_broker, cmpiCnt,cmpiType, &rc);
    type = CDGetType (_broker, cmpiArray, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIArray:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CDGetType (_broker, cmpiDateTime, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIDateTime:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));
    type = CDGetType (_broker, ctx, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIContext:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CDGetType (_broker, rslt, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIResult:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    rc1 = NULL;
    selExp = CMNewSelectExp(_broker,
        "SELECT c,b FROM TestCMPI_Indication WHERE c='c' OR b=1",
        "WQL",
        NULL,
        rc1);
    PROV_LOG ("++++ CMNewSelectExp with rc set to NULL Called");

    selExp = CMNewSelectExp(_broker,
        "SELECT c,b FROM TestCMPI_Indication",
        "WQL",
        NULL,
        &rc);
    PROV_LOG ("++++ Status of CMNewSelectExp: (%s) ",
        strCMPIStatus (rc));
    type = CDGetType (_broker, selExp, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPISelectExp:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    handle = objPath1->hdl;
    objPath1->hdl = NULL;
    rc = CMRelease(objPath1);
    PROV_LOG ("++++ Status of CMRelease(objPath1): (%s)",
        strCMPIStatus (rc));
    objPath1->hdl = handle;
    rc = CMRelease(objPath1);
    PROV_LOG ("++++ Status of CMRelease(objPath1): (%s)",
        strCMPIStatus (rc));

    objPath1 = CMNewObjectPath(_broker,
        "test/TestProvider",
        "TestCMPI_Instance",
        &rc);
    PROV_LOG ("++++ Status of CMNewObjectPath for TestCMPI_Instance : (%s)",
        strCMPIStatus (rc));

    PROV_LOG_CLOSE();
    cmpiEnum = CBEnumInstances(_broker, ctx, objPath1, NULL, &rc);
    PROV_LOG_OPEN (_ClassName, _ProviderLocation);

    PROV_LOG ("++++ Status of CBEnumInstances : (%s)",
        strCMPIStatus (rc));
    type = CDGetType (_broker, cmpiEnum, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIEnumeration:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CDGetType (_broker, args, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIArgs:"
        " (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));


    PROV_LOG ("++++ Calling mbEncIsOfType function ");
    bol = CDIsOfType (_broker, NULL, "No object", rc1);
    if(!bol)
    {
        PROV_LOG ("++++Calling mbEncIsOfType with NULL rc and wrong"
            " parameters");
    }
    bol = CDIsOfType (_broker, instance, "CMPIInstance", rc1);
    if(!bol)
    {
        PROV_LOG ("++++ Calling mbEncIsOfType with NULL rc");
    }
    bol = CDIsOfType (_broker, NULL, "No object", &rc);
    PROV_LOG ("++++ Error Status of mbEncIsOfType : (%s)", strCMPIStatus (rc));

    bol = CDIsOfType (_broker, instance, "CMPIInstance", &rc);
    if ( bol )
    {
        PROV_LOG ("++++ CDIsOfType for CMPIInstance status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, instance, "CMPI", &rc);
    if ( !bol )
    {
        PROV_LOG ("++++ CDIsOfType for CMPIInstance status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, objPath, "CMPIObjectPath", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIObjectPath status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, objPath, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIObjectPath status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiDateTime, "CMPIDateTime", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIDateTime status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiDateTime, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIDateTime status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiStr, "CMPIString", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIString status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiStr, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIString status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, _broker, "CMPIBroker", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIBroker status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, _broker, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIBroker status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }


    bol = CDIsOfType (_broker, cmpiArray, "CMPIArray", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIArray status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiArray, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIArray status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIResult status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, rslt, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIResult status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, ctx, "CMPIContext", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIContext status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }
    bol = CDIsOfType (_broker, ctx, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIContext status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiEnum, "CMPIEnumeration", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIEnumeration status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, cmpiEnum, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIEnumeration status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    /* Testcase to increase coverage in CMPI_Enumeration.cpp*/
    rc = CMRelease(cmpiEnum);
    PROV_LOG ("++++ Status of CMRelease on cmpiEnum :(%s)",
        strCMPIStatus (rc));

    /**********************************************************/

    bol = CDIsOfType (_broker, selExp, "CMPISelectExp", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPISelectExp status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, selExp, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPISelectExp status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, args, "CMPIArgs", &rc);
    if (bol)
    {
        PROV_LOG ("++++ CDIsOfType for CMPIArgs status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    bol = CDIsOfType (_broker, args, "CMPI", &rc);
    if (!bol)
    {
        PROV_LOG ("++++ CdIsOfType for CMPIArgs status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }

    type = CMGetMessage (_broker,
        "msgid",
        "Test 0 arguments",
        &rc,
        0);
    PROV_LOG ("++++ Status of GetMessage with 0 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0",
        &rc,
        CMFmtArgs1(CMFmtChars("one argument")));
    PROV_LOG ("++++ Status of GetMessage with 1 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1",
        &rc,
        CMFmtArgs2(CMFmtChars("Sint32 ::"),
            CMFmtSint(-1)));
    PROV_LOG ("++++ Status of GetMessage with 2 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2",
        &rc,
        CMFmtArgs3(CMFmtChars("Sint32, Uint32 ::"),
            CMFmtSint(-1),
            CMFmtUint(1)));
    PROV_LOG ("++++ Status of GetMessage with 3 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2, $3",
        &rc,
        CMFmtArgs4(CMFmtChars("Sint32, Uint32, Sint64 ::"),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64)));
    PROV_LOG ("++++ Status of GetMessage with 4 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2, $3, $4",
        &rc,
        CMFmtArgs5(CMFmtChars("Sint32, Uint32, Sint64, Uint64 ::"),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64)));
    PROV_LOG ("++++ Status of GetMessage with 5 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2, $3, $4, $5",
        &rc,
        CMFmtArgs6(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64 ::"),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64)));
    PROV_LOG ("++++ Status of GetMessage with 6 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2, $3, $4, $5, $6",
        &rc,
        CMFmtArgs7(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64,"
            " Boolean:: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64),
            CMFmtBoolean(1)));
    PROV_LOG ("++++ Status of GetMessage with 7 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2, $3, $4, $5, $6, $7",
        &rc,
        CMFmtArgs8(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64,"
            " Boolean, chars:: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64),
            CMFmtBoolean(1),
            CMFmtChars("chars")));
    PROV_LOG ("++++ Status of GetMessage with 8 arguments(%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage (_broker,
        "msgid",
        "Test $0 $1, $2, $3, $4, $5, $6, $7, $8",
        &rc,
        CMFmtArgs9(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64,"
            " Boolean, chars, String :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64),
            CMFmtBoolean(1),
            CMFmtChars("chars"),
            CMFmtString(cmpiStr)));
    PROV_LOG ("++++ Status of GetMessage with 9 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    strcpy(path,"path");
    rc = CMOpenMessageFile(_broker, path, &msgFileHandle);
    PROV_LOG ("++++ Status of CMOpenMessageFile (%s) ",
        strCMPIStatus (rc));

    type = CMGetMessage2(_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test zero arguments",
        &rc,
        0);
    PROV_LOG ("++++ Status of GetMessage2 with 0 argument (%s) type (%s)",
            strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2(_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0",
        &rc,
        CMFmtArgs1(CMFmtChars("Single argument")));
    PROV_LOG ("++++ Status of GetMessage2 with 1 argument (%s) type (%s)",
            strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2(_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1",
        &rc,
        CMFmtArgs2(CMFmtChars("Sint32 ::"),CMFmtSint(1)));
    PROV_LOG ("++++ Status of GetMessage2 with 2 arguments (%s) type (%s)",
            strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2",
        &rc,
        CMFmtArgs3(CMFmtChars("Sint32, Uint32 :: "),
            CMFmtSint(-1),
            CMFmtUint(1)));
    PROV_LOG ("++++ Status of GetMessage2 with 3 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2, $3",
        &rc,
        CMFmtArgs4(CMFmtChars("Sint32, Uint32, Sint64 :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64)));
    PROV_LOG ("++++ Status of GetMessage2 with 4 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2, $3, $4",
        &rc,
        CMFmtArgs5(CMFmtChars("Sint32, Uint32, Sint64, Uint64 :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64)));
    PROV_LOG ("++++ Status of GetMessage2 with 5 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2, $3, $4, $5",
        &rc,
        CMFmtArgs6(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64 :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64)));
    PROV_LOG ("++++ Status of GetMessage2 with 6 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2, $3, $4, $5, $6",
        &rc,
        CMFmtArgs7(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64,"
            " Boolean :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64),
            CMFmtBoolean(1)));
    PROV_LOG ("++++ Status of GetMessage2 with 7 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2, $3, $4, $5, $6, $7",
        &rc,
        CMFmtArgs8(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64,"
            " Boolean, chars :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64),
            CMFmtBoolean(1),
            CMFmtChars("chars")));
    PROV_LOG ("++++ Status of GetMessage2 with 8 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    type = CMGetMessage2 (_broker,
        "Common.CIMStatusCode.CIM_ERR_SUCCESS",
        msgFileHandle,
        "Test $0 $1, $2, $3, $4, $5, $6, $7, $8",
        &rc,
        CMFmtArgs9(CMFmtChars("Sint32, Uint32, Sint64, Uint64, Real64,"
            " Boolean, chars, String :: "),
            CMFmtSint(-1),
            CMFmtUint(1),
            CMFmtSint64(-64),
            CMFmtUint64(64),
            CMFmtReal(64.64),
            CMFmtBoolean(1),
            CMFmtChars("chars"),
            CMFmtString(cmpiStr)));
    PROV_LOG ("++++ Status of GetMessage2 with 9 arguments (%s) type (%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    rc = CMCloseMessageFile(_broker, msgFileHandle);
    PROV_LOG ("++++ Status of CMCloseMessageFile (%s) ",
        strCMPIStatus (rc));

    CMRelease(instance1);
    CMRelease(instanceErr);
    return flag ;


}
コード例 #10
0
    char *result = NULL;


    PROV_LOG_OPEN (_ClassName, _ProviderLocation);

    PROV_LOG ("--- %s CMPI InvokeMethod() called", _ClassName);

    class = CMGetClassName (ref, &rc);

    PROV_LOG ("InvokeMethod: checking for correct classname [%s]",
        CMGetCharsPtr (class,NULL));

    PROV_LOG ("Calling CMGetArgCount");
    arg_cnt = CMGetArgCount (in, &rc);
    PROV_LOG ("++++ (%s)", strCMPIStatus (rc));

    PROV_LOG ("InvokeMethod: We have %d arguments for operation [%s]: ",
        arg_cnt,
        methodName);

    if (arg_cnt > 0)
    {
        PROV_LOG ("Calling CMGetArgAt");
        for (index = 0; index < arg_cnt; index++)
        {
            data = CMGetArgAt (in, index, &argName, &rc);
            if (data.type == CMPI_uint32)
            {
                PROV_LOG ("#%d: %s (uint32), value: %d",
                    index,
コード例 #11
0
static CMPI_THREAD_RETURN CMPI_THREAD_CDECL
thread (void *args)
{
  CMPIString *str = NULL;
  CMPIStatus rc = { CMPI_RC_OK, NULL };
  CMPIStatus rc_Eval = { CMPI_RC_OK, NULL };
  CMPIStatus rc_Clone = { CMPI_RC_OK, NULL };
  CMPIStatus rc_Inst = { CMPI_RC_OK, NULL };
  CMPIStatus rc_Pred = { CMPI_RC_OK, NULL };
  CMPIStatus rc_Array = { CMPI_RC_OK, NULL };
  CMPIStatus rc_CMGetPropertyAt = { CMPI_RC_OK, NULL };

  CMPIString *type = NULL;
  CMPISelectExp *clone = NULL;
  CMPIBoolean evalRes;
  CMPIInstance *inst = NULL;
  CMPIObjectPath *objPath = NULL;
  CMPIString *name = NULL;
  CMPIData prop_data = { 0, CMPI_null, {0} };
  CMPIData data = { 0, CMPI_null, {0} };
  CMPIArray *projection = NULL;
  /* General purpose counters */
  unsigned int idx;
  CMPICount cnt;
  /* Select Condition and sub conditions */
  CMPISelectCond *cond = NULL;
  int sub_type;
  CMPISubCond *subcnd = NULL;
  /* Predicate operations */
  CMPICount pred_cnt;
  unsigned int pred_idx;
  CMPIPredicate *pred = NULL;
  CMPIType pred_type;
  CMPIPredOp pred_op;
  CMPIString *left_side = NULL;
  CMPIString *right_side = NULL;
  /* Thread specific data, passed in via arguments. This could also
     be passed via thread specific data.. */
  void **arguments = (void **) args;
  CMPIContext *ctx;
  CMPISelectExp *se;
  char *ns;
  CMPIBroker *broker;

 // Copy over the CMPISelectExp, CMPIContext, CMPIBroker and the ns from the argument. 
  se = (CMPISelectExp *)arguments[0];
  ctx = (CMPIContext *)arguments[1];
  broker = (CMPIBroker *)arguments[2];
  ns = (char *)arguments[3];

  free(arguments);

  _thread_active = 1;
  // Get the CMPIContext and attach it to this thread.
  rc = CBAttachThread (broker, ctx);

  // Wait until we get the green signal.
  while (_thread_runs == 0)
    {
	broker->xft->threadSleep(1000);
    }

  //PROV_LOG_OPEN (_IndClassName, _ProviderLocation);
  PROV_LOG ("--- CBAttachThread callled.");
  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));

  PROV_LOG ("--- %s CMPI thread(void *) running",_IndClassName);


  PROV_LOG ("-- #1 Clone");
  clone = CMClone (se, &rc_Clone);
  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Clone), (rc_Clone.msg == 0) ? "" : CMGetCharPtr(rc_Clone.msg));
  if (clone)
    CMRelease (clone);

  /*
     This functionality is not used in indication providers, but instead in
     ExecQuery provider API (instance providers). But for the sake
     of completness this functionality is also used here. */

  PROV_LOG ("-- #1.1 CMNewSelectExp");
  str = CMGetSelExpString (se, &rc);
  clone =
    //CMPI_CQL_NewSelectExp (broker, CMGetCharPtr (str), "CIMxCQL",
    CMNewSelectExp (broker, CMGetCharPtr (str), "CIM:CQL",
                    &projection, &rc_Clone);

  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Clone), (rc_Clone.msg == 0) ? "" : CMGetCharPtr(rc_Clone.msg));
  if (clone)
    {
      if (projection)
        {
          PROV_LOG ("--- #1.2 Projection list is: ");
          cnt = CMGetArrayCount (projection, &rc_Array);
          PROV_LOG ("---- %s, [%s]", strCMPIStatus (rc_Array),(rc_Array.msg == 0) ? "" : CMGetCharPtr(rc_Array.msg));
          PROV_LOG ("--- #1.3 CMGetArrayCount, %d", cnt);
          for (idx = 0; idx < cnt; idx++)
            {
              PROV_LOG ("--- #1.4 CMGetArrayElementAt");
              data = CMGetArrayElementAt (projection, idx, &rc_Array);
              PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Array), (rc_Array.msg == 0) ? "" : CMGetCharPtr(rc_Array.msg));
              PROV_LOG ("---- type is : %d", data.type);
              if (data.type == CMPI_chars)
                {
                  PROV_LOG ("---- %s (chars)", data.value.chars);
                }
              if (data.type == CMPI_string)
                {
                  PROV_LOG ("---- %s (string)",
                            CMGetCharPtr (data.value.string));
                }
            }
        }
      else
        {
          PROV_LOG
            ("--- #1.2 No projection list, meaning it is SELECT * .... ");
        }
    }
  // This is how an indication provider would work.
  //  Create an objectpath + instance and use CMEvaluateSelExp
  //  OR
  //  use CMEvaluateSelExpUsingAccessor and pass in the function that would
  // provide the properties values.

  PROV_LOG ("-- #2 MakeObjectPath");
  // Create instance

  objPath = make_ObjectPath (broker, _Namespace, _IndClassName);
  type = CDGetType (broker, objPath, &rc_Inst);
  PROV_LOG ("---- %s (%s) [%s]", CMGetCharPtr (type), strCMPIStatus (rc_Inst),(rc_Inst.msg == 0) ? "" : CMGetCharPtr(rc_Inst.msg));
  CMRelease (type);

  PROV_LOG ("-- #3 Instance");
  inst = CMNewInstance (broker, objPath, &rc_Inst);
  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Inst), (rc_Inst.msg == 0) ? "" : CMGetCharPtr(rc_Inst.msg));

  if (rc_Inst.rc == CMPI_RC_ERR_NOT_FOUND)
    {
      PROV_LOG (" --- Class %s is not found in the %s namespace!",
                _IndClassName, _Namespace);
      PROV_LOG (" --- Aborting!!! ");
      goto exit;
    }

  type = CDGetType (broker, inst, &rc_Inst);
  if (type)
    {
      PROV_LOG ("---- %s (%s) [%s]", CMGetCharPtr (type), strCMPIStatus (rc_Inst),(rc_Inst.msg == 0) ? "" : CMGetCharPtr(rc_Inst.msg));
      CMRelease (type);
    }

  PROV_LOG ("- CMGetPropertyCount: %d", CMGetPropertyCount (inst, &rc));
  // Set each property.
  for (idx = 0; idx < CMGetPropertyCount (inst, &rc); idx++)
    {
      prop_data = CMGetPropertyAt (inst, idx, &name, &rc_CMGetPropertyAt);
      // Really dumb way of doing it. Just set each property with its own property name.
      if (prop_data.type == CMPI_string)
        {
          CMSetProperty (inst, CMGetCharPtr (name), CMGetCharPtr (name),
                         CMPI_chars);
        }
      prop_data = CMGetPropertyAt (inst, idx, &name, &rc_CMGetPropertyAt);

      PROV_LOG ("-- %d: %s(%s: %s: %s) [%s]", idx,
                CMGetCharPtr (name),
                strCMPIType (prop_data.type),
                strCMPIValueState (prop_data.state),
                strCMPIValue (prop_data.value),
                strCMPIStatus (rc_CMGetPropertyAt));

    }

  PROV_LOG ("-- #4 Evaluate using instance");
  evalRes = CMEvaluateSelExp (se, inst, &rc_Eval);
  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Eval), (rc_Eval.msg == 0) ? "" : CMGetCharPtr(rc_Eval.msg));
  if (evalRes == CMPI_true)
    {
      PROV_LOG ("--- True, sending indication");
      rc_Eval = CBDeliverIndication (broker, ctx, _Namespace, inst);
      PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Eval), (rc_Eval.msg == 0) ? "" : CMGetCharPtr(rc_Eval.msg));
    }
  else
    {
      PROV_LOG ("--- False");
    }

  PROV_LOG ("-- #4.1 Evalute using accessor");
  evalRes =
    CMEvaluateSelExpUsingAccessor (se, instance_accessor, broker, &rc_Eval);
  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Eval), (rc_Eval.msg == 0) ? "" : CMGetCharPtr(rc_Eval.msg));
  if (evalRes == CMPI_true)
    {
      PROV_LOG ("--- True, but not sending indication");
    }
  else
    {
      PROV_LOG ("--- False");
    }

  PROV_LOG ("-- #5 CMGetSelExpString");
  str = CMGetSelExpString (se, &rc);
  type = CDGetType (broker, str, &rc_Inst);
  if (type != NULL)
    {
      PROV_LOG ("---- %s (%s) [%s]", CMGetCharPtr (type), strCMPIStatus (rc_Inst), (rc_Inst.msg == 0) ? "" : CMGetCharPtr(rc_Inst.msg));
      CMRelease (type);
    }

  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));
  PROV_LOG ("-- #5.1 Query is [%s]", CMGetCharPtr (str));
  PROV_LOG ("-- #5.2 Query is [%s]", ns);


  PROV_LOG ("-- #6 Continue evaluating using GetDOC");
  {
    cond = CMGetDoc (se, &rc);
    PROV_LOG ("---- %s [%s]", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));
    if (cond != NULL)
      {

        PROV_LOG ("--- #6.1 CMGetSubCondCountAndType ");
        cnt = CMGetSubCondCountAndType (cond, &sub_type, &rc);
        PROV_LOG ("---- %s %s", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));


        PROV_LOG ("---- Number of disjunctives: %d, Type: %X", cnt, sub_type);

        /* Parsing the disjunctives */
        for (idx = 0; idx < cnt; idx++)
          {
            PROV_LOG ("--- #6.2 CMGetSubCondAt @ %d ", idx);
            subcnd = CMGetSubCondAt (cond, idx, &rc);
            PROV_LOG ("---- %s [%s]", strCMPIStatus (rc),(rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));

            PROV_LOG ("--- #6.3 CMGetPredicateCount");
            pred_cnt = CMGetPredicateCount (subcnd, &rc);
            PROV_LOG ("---- %s [%s]", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));
            PROV_LOG ("---- Number of predicates in the conjuctives: %d",
                      pred_cnt);

            /* Parsing throught conjuctives */
            for (pred_idx = 0; pred_idx < pred_cnt; pred_idx++)
              {
                PROV_LOG ("--- #6.4 CMGetPredicateAt, %d", pred_idx);
                pred = CMGetPredicateAt (subcnd, pred_idx, &rc);

                PROV_LOG ("---- %s [%s]", strCMPIStatus (rc),(rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));
                PROV_LOG ("--- #6.4 CMGetPredicateData");
                rc = CMGetPredicateData (pred,
                                         &pred_type,
                                         &pred_op, &left_side, &right_side);
                PROV_LOG ("---- %s [%s]", strCMPIStatus (rc),(rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));

                PROV_LOG ("----- Type: %s , CMPIPredOp: %s, LS: %s, RS: %s",
                          strCMPIType (pred_type), strCMPIPredOp (pred_op),
                          CMGetCharPtr (left_side),
                          CMGetCharPtr (right_side));

                PROV_LOG ("--- #6.5 Evaluate using predicate");
#ifdef CMPI_VER_100
// The CMEvaluatePredicate is gone in the CMPI 1.0 standard.
                evalRes =
                  CMEvaluatePredicateUsingAccessor (pred, instance_accessor,
                                                    NULL, &rc_Pred);
#else
                // One can also evaluate this specific predicate
                evalRes =
                  CMEvaluatePredicate (pred, "PredicateEvaluation",
                                       CMPI_chars, &rc_Pred);
#endif
                PROV_LOG ("---- %s [%s]", strCMPIStatus (rc_Pred), (rc_Pred.msg == 0) ? "" : CMGetCharPtr(rc_Pred.msg));

                if (evalRes == CMPI_true)
                  {
                    PROV_LOG ("--- True");
                  }
                else
                  {
                    PROV_LOG ("--- False");
                  }
              }

          }
      }
  }
  PROV_LOG ("-- #7 GetCOD");
  {
    cond = CMGetCod (se, &rc);
    PROV_LOG ("---- %s [%s]", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));
    /* Currently this is not supported in Pegasus. */
    if (cond != NULL)
      {
      }
  }
exit:
  PROV_LOG ("--- CBDetachThread called");
  rc = CBDetachThread (broker, ctx);
  free (ns);
  PROV_LOG ("---- %s [%s]", strCMPIStatus (rc), (rc.msg == 0) ? "" : CMGetCharPtr(rc.msg));

  PROV_LOG ("--- %s CMPI thread(void *) exited", _IndClassName);

  _thread_active = 0;
  _thread_runs = 0;
  return (CMPI_THREAD_RETURN) 0;
}
コード例 #12
0
CMPIStatus
TestCMPIErrorProviderInvokeMethod (CMPIMethodMI * mi,
                                    const CMPIContext * ctx,
                                    const CMPIResult * rslt,
                                    const CMPIObjectPath * ref,
                                    const char *methodName,
                                    const CMPIArgs * in, CMPIArgs * out)
{
  CMPIString *class_name = NULL;
  CMPIStatus rc = { CMPI_RC_OK, NULL };
  CMPIError *cmpiError;
  CMPIError *cmpiErrorClone;
  CMPICount i, arrSize;
  CMPIObjectPath *objPath = NULL;


  CMPIUint32 brokerCapabilities;
  /* CMPIError data */
  const char* inOwningEntity = "ACME";
  CMPIString* outOwningEntity;
  const char* inMsgID = "ACME0023";
  CMPIString* outMsgID;
  const char* inMsg = "ACME0023 Need to restock Road Runner bait and traps.";
  CMPIString* outMsg;
  const CMPIErrorSeverity inSev = ErrorSevMedium;
  CMPIErrorSeverity outSev;
  const CMPIErrorProbableCause inPc = Equipment_Malfunction;
  CMPIErrorProbableCause outPc;
  const CMPIrc inCIMStatusCode = CMPI_RC_ERR_FAILED;
  CMPIrc outCIMStatusCode;
  const char * inCIMStatusCodeDesc = "another failed attempt at road "
      "runner elimination";
  CMPIString* outCIMStatusCodeDesc;
  const CMPIErrorType inErrType = OtherErrorType;
  CMPIErrorType outErrType;
  const char* inOtherErrType = "Pervasive Coyote Incompetance";
  CMPIString* outOtherErrType;
  const char* inPcd = "Incorrect use of equipment";
  CMPIString* outPcd;
  CMPIArray *inRecActions;
  CMPIArray *outRecActions;
  CMPIArray *inMsgArgs;
  CMPIArray *outMsgArgs;
  CMPIValue raOne;
  CMPIValue raTwo;
  const char* inErrSource = "Acme bomb";
  CMPIString* outErrSource;
  const CMPIErrorSrcFormat inErrSourceFormat = CMPIErrSrcOther;
  CMPIErrorSrcFormat outErrSourceFormat;
  const char* inOtherErrSourceFormat = "no idea";
  CMPIString* outOtherErrSourceFormat;
  CMPIData retData;
  PROV_LOG_OPEN (_ClassName, _ProviderLocation);

  PROV_LOG ("Calling CBGetBrokerCapabilities");
  brokerCapabilities = CBGetBrokerCapabilities(_broker);
  if (brokerCapabilities & CMPI_MB_Supports_Extended_Error)
  {
      PROV_LOG("CMPI_MB_Supports_Extended_Error Support : True");
  }
  else
  {
      PROV_LOG("CMPI_MB_Supports_Extended_Error Support : False");
      CMReturnWithString(CMPI_RC_ERR_NOT_SUPPORTED, 
          CMNewString(_broker,
          "Extended error support not avilable", NULL));
  } 

  PROV_LOG ("--- %s CMPI InvokeMethod() called", _ClassName);

  class_name = CMGetClassName (ref, &rc);

  PROV_LOG ("InvokeMethod: checking for correct classname [%s]",
            CMGetCharsPtr (class_name,NULL));

  PROV_LOG ("Calling CMNewCMPIError");
  cmpiError = CMNewCMPIError(_broker, inOwningEntity, inMsgID, inMsg,
      inSev, inPc, inCIMStatusCode, &rc);
  PROV_LOG ("++++ (%s) CMNewCMPIError", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetErrorType");
  rc = CMSetErrorType(cmpiError, inErrType);
  PROV_LOG ("++++ (%s) CMSetErrorType", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetOtherErrorType");
  rc = CMSetOtherErrorType(cmpiError, inOtherErrType);
  PROV_LOG ("++++ (%s) CMSetOtherErrorType", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetProbableCauseDescription");
  rc = CMSetProbableCauseDescription(cmpiError, inPcd);
  PROV_LOG ("++++ (%s) CMSetProbableCauseDescription", strCMPIStatus (rc));

  inRecActions = CMNewArray(_broker, 2, CMPI_string, &rc);
  PROV_LOG ("++++ (%s) CMNewArray", strCMPIStatus (rc));
  raOne.string = CMNewString(_broker, "Fire coyote.", &rc);
  PROV_LOG ("++++ (%s) CMNewString", strCMPIStatus (rc));
  rc = CMSetArrayElementAt(inRecActions, 0, &raOne, CMPI_string);
  PROV_LOG ("++++ (%s) CMSetArrayElementAt [0]", strCMPIStatus (rc));
  raTwo.string = CMNewString(_broker, "Give peace a chance.", &rc);
  PROV_LOG ("++++ (%s) CMNewString", strCMPIStatus (rc));
  rc = CMSetArrayElementAt(inRecActions, 1, &raTwo, CMPI_string);
  PROV_LOG ("++++ (%s) CMSetArrayElementAt [1]", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetRecommendedActions");
  rc = CMSetRecommendedActions(cmpiError, inRecActions);
  PROV_LOG ("++++ (%s) CMSetRecommendedActions", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetErrorSource");
  rc = CMSetErrorSource(cmpiError, inErrSource);
  PROV_LOG ("++++ (%s) CMSetErrorSource", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetErrorSourceFormat");
  rc = CMSetErrorSourceFormat(cmpiError, inErrSourceFormat);
  PROV_LOG ("++++ (%s) CMSetErrorSourceFormat", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetOtherErrorSourceFormat");
  rc = CMSetOtherErrorSourceFormat(cmpiError, inOtherErrSourceFormat);
  PROV_LOG ("++++ (%s) CMSetOtherErrorSourceFormat", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetCIMStatusCodeDescription");
  rc = CMSetCIMStatusCodeDescription(cmpiError, inCIMStatusCodeDesc);
  PROV_LOG ("++++ (%s) CMSetCIMStatusCodeDescription", strCMPIStatus (rc));

  inMsgArgs = CMNewArray(_broker, 1, CMPI_string, &rc);
  PROV_LOG ("++++ (%s) CMNewArray", strCMPIStatus (rc));
  raOne.string = CMNewString(_broker, "no real inserts", &rc);
  PROV_LOG ("++++ (%s) CMNewString", strCMPIStatus (rc));
  rc = CMSetArrayElementAt(inMsgArgs, 0, &raOne, CMPI_string);
  PROV_LOG ("++++ (%s) CMSetArrayElementAt [0]", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetMessageArguments");
  rc = CMSetMessageArguments(cmpiError, inMsgArgs);
  PROV_LOG ("++++ (%s) CMSetMessageArguments", strCMPIStatus (rc));

  PROV_LOG ("First clone the CMPIError.");
  cmpiErrorClone = CMClone(cmpiError, &rc);
  PROV_LOG ("++++ (%s) CMClone", strCMPIStatus (rc));

  PROV_LOG ("Ok, reading back fields to verify");
  
  PROV_LOG ("Calling CMGetErrorType");
  outErrType = CMGetErrorType(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetErrorType (%d)", strCMPIStatus (rc), outErrType);

  PROV_LOG ("Calling CMGetOtherErrorType");
  outOtherErrType = CMGetOtherErrorType(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetOtherErrorType (%s)", strCMPIStatus (rc), 
      CMGetCharsPtr(outOtherErrType,NULL));

  PROV_LOG ("Calling CMGetOwningEntity");
  outOwningEntity = CMGetOwningEntity(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetOwningEntity (%s)", strCMPIStatus (rc), 
      CMGetCharsPtr(outOwningEntity,NULL));

  PROV_LOG ("Calling CMGetMessageID");
  outMsgID = CMGetMessageID(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetMessageID (%s)", strCMPIStatus (rc), 
      CMGetCharsPtr(outMsgID,NULL));

  PROV_LOG ("Calling CMGetErrorMessage");
  outMsg = CMGetErrorMessage(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetErrorMessage (%s)", strCMPIStatus (rc), 
      CMGetCharsPtr(outMsg,NULL));

  PROV_LOG ("Calling CMGetPerceivedSeverity");
  outSev = CMGetPerceivedSeverity(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetPerceivedSeverity (%d)", strCMPIStatus (rc),
      outSev);

  PROV_LOG ("Calling CMGetProbableCause");
  outPc = CMGetProbableCause(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetProbableCause (%d)", strCMPIStatus (rc),
      outPc);

  PROV_LOG ("Calling CMGetProbableCauseDescription");
  outPcd = CMGetProbableCauseDescription(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetProbableCauseDescription (%s)",
      strCMPIStatus (rc),
      CMGetCharsPtr(outPcd,NULL));

  PROV_LOG ("Calling CMGetRecommendedActions");
  outRecActions = CMGetRecommendedActions(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetRecommendedActions", strCMPIStatus (rc));
  arrSize = CMGetArrayCount(outRecActions, &rc);
  PROV_LOG ("++++ (%s) CMGetArrayCount (%d)", strCMPIStatus (rc), arrSize);
  for (i = 0 ; i < arrSize ; i++)
  {
      CMPIData dta = CMGetArrayElementAt(outRecActions, i, &rc);
      PROV_LOG ("++++ (%s) CMGetArrayElementAt (%d:%s)", strCMPIStatus (rc),
          i, CMGetCharsPtr(dta.value.string,NULL));
  }

  PROV_LOG ("Calling CMGetErrorSource");
  outErrSource = CMGetErrorSource(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetErrorSource (%s)", strCMPIStatus (rc),
      CMGetCharsPtr(outErrSource,NULL));

  PROV_LOG ("Calling CMGetErrorSourceFormat");
  outErrSourceFormat = CMGetErrorSourceFormat(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetErrorSourceFormat (%d)", strCMPIStatus (rc),
      outErrSourceFormat);

  PROV_LOG ("Calling CMGetOtherErrorSourceFormat");
  outOtherErrSourceFormat = CMGetOtherErrorSourceFormat(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetOtherErrorSourceFormat (%s)", strCMPIStatus (rc),
      CMGetCharsPtr(outOtherErrSourceFormat,NULL));

  PROV_LOG ("Calling CMGetCIMStatusCode");
  outCIMStatusCode = CMGetCIMStatusCode(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetCIMStatusCode (%d)", strCMPIStatus (rc),
      outCIMStatusCode);

  PROV_LOG ("Calling CMGetCIMStatusCodeDescription");
  outCIMStatusCodeDesc = CMGetCIMStatusCodeDescription(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetCIMStatusCodeDescription (%s)", strCMPIStatus (rc),
      CMGetCharsPtr(outCIMStatusCodeDesc,NULL));

  PROV_LOG ("Calling CMGetMessageArguments");
  outMsgArgs = CMGetMessageArguments(cmpiErrorClone, &rc);
  PROV_LOG ("++++ (%s) CMGetMessageArguments", strCMPIStatus (rc));
  arrSize = CMGetArrayCount(outMsgArgs, &rc);
  PROV_LOG ("++++ (%s) CMGetArrayCount (%d)", strCMPIStatus (rc), arrSize);
  for (i = 0 ; i < arrSize ; i++)
  {
      CMPIData dta = CMGetArrayElementAt(outMsgArgs, i, &rc);
      PROV_LOG ("++++ (%s) CMGetArrayElementAt (%d:%s)", strCMPIStatus (rc),
          i, CMGetCharsPtr(dta.value.string,NULL));
  }

  PROV_LOG ("Calling CMPIResultFT.returnData");
  rc = (rslt)->ft->returnError (rslt, cmpiErrorClone);
  PROV_LOG ("++++ (%s) returnData", strCMPIStatus (rc));

  PROV_LOG ("Releasing cloned CMPIError");
  rc = CMRelease(cmpiErrorClone);
  PROV_LOG ("++++ (%s) CMClone", strCMPIStatus (rc));

//Test Error Paths
  PROV_LOG ("Testing for Error Paths in CMPI_Error.cpp");
  PROV_LOG ("Calling CMNewCMPIError");
  cmpiError = CMNewCMPIError(_broker, 
      inOwningEntity,
      inMsgID,
      inMsg,
      inSev,
      inPc,
      inCIMStatusCode,
      &rc);
  PROV_LOG ("++++ (%s) CMNewCMPIError", strCMPIStatus (rc));

  PROV_LOG ("Calling CMGetErrorType without setting the ErrorType");
  outErrType = CMGetErrorType(cmpiError, &rc);
  if (!outErrType)
  {
      PROV_LOG ("++++ (%s) CMGetErrorType (%d)", strCMPIStatus (rc),
          outErrType);
  }

  PROV_LOG ("Calling CMGetOtherErrorType without setting the OtherErrorType");
  outOtherErrType = CMGetOtherErrorType(cmpiError, &rc);
  if (outOtherErrType == NULL)
  {
      PROV_LOG ("++++ (%s) CMGetOtherErrorType", strCMPIStatus (rc));
  }

  PROV_LOG ("Testing CMSetMessageArguments");
  CMRelease(inMsgArgs);
  inMsgArgs = CMNewArray(_broker, 1, CMPI_uint32, &rc);
  PROV_LOG ("++++ (%s) CMNewArray inMsgArgs of CMPI_uint32 type",
      strCMPIStatus (rc));
  raOne.uint32 = 32;
  rc = CMSetArrayElementAt(inMsgArgs, 0, &raOne, CMPI_uint32);
  PROV_LOG ("++++ (%s) CMSetArrayElementAt [0]", strCMPIStatus (rc));
  PROV_LOG ("Calling CMSetMessageArguments with input array of uint32");
  rc = CMSetMessageArguments(cmpiError, inMsgArgs);
  PROV_LOG ("++++ (%s) CMSetMessageArguments", strCMPIStatus (rc));
  inMsgArgs->hdl = NULL;
  PROV_LOG ("Calling CMSetMessageArguments with input array with NULL handle");
  rc = CMSetMessageArguments(cmpiError, inMsgArgs);
  PROV_LOG ("++++ (%s) CMSetMessageArguments", strCMPIStatus (rc));

  PROV_LOG ("Testing CMSetRecommendedActions");
  CMRelease(inRecActions);
  inRecActions = CMNewArray(_broker, 1, CMPI_uint32, &rc);
  PROV_LOG ("++++ (%s) CMNewArray inRecActions of CMPI_uint32",
      strCMPIStatus (rc));
  raOne.uint32 = 32;
  rc = CMSetArrayElementAt(inRecActions, 0, &raOne, CMPI_uint32);
  PROV_LOG ("++++ (%s) CMSetArrayElementAt [0]", strCMPIStatus (rc));
  PROV_LOG ("Calling CMSetRecommendedActions with input array of CMPI_uint32");
  rc = CMSetRecommendedActions(cmpiError, inRecActions);
  PROV_LOG ("++++ (%s) CMSetRecommendedActions", strCMPIStatus (rc));
  inRecActions->hdl = NULL;
  PROV_LOG ("Calling CMSetRecommendedActions with input array"
      " with NULL handle");
  rc = CMSetRecommendedActions(cmpiError, inRecActions);
  PROV_LOG ("++++ (%s) CMSetRecommendedActions", strCMPIStatus (rc));

  /* Cases when CMPIError object handle is NULL*/
  cmpiError->hdl = NULL;

  PROV_LOG ("Clone the CMPIError with NULL handle.");
  cmpiErrorClone = CMClone(cmpiError, &rc);
  if (cmpiErrorClone == NULL)
  {
      PROV_LOG ("++++ (%s) CMClone", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetErrorType with NULL handle");
  outErrType = CMGetErrorType(cmpiError, &rc);
  if (!outErrType)
  {
      PROV_LOG ("++++ (%s) CMGetErrorType (%d)", strCMPIStatus (rc),
          outErrType);
  }

  PROV_LOG ("Calling CMGetOtherErrorType with NULL handle");
  outOtherErrType = CMGetOtherErrorType(cmpiError, &rc);
  if (outOtherErrType == NULL)
  {
      PROV_LOG ("++++ (%s) CMGetOtherErrorType ", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetOwningEntity with NULL handle");
  outOwningEntity = CMGetOwningEntity(cmpiError, &rc);
  if (outOwningEntity == NULL)
  {
      PROV_LOG ("++++ (%s) CMGetOwningEntity ", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetMessageID with NULL handle");
  outMsgID = CMGetMessageID(cmpiError, &rc);
  if (!outMsgID)
  {
      PROV_LOG ("++++ (%s) CMGetMessageID", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetErrorMessage with NULL handle");
  outMsg = CMGetErrorMessage(cmpiError, &rc);
  if (!outMsg)
  {
      PROV_LOG ("++++ (%s) CMGetErrorMessage", strCMPIStatus (rc));
  }
  PROV_LOG ("Calling CMGetPerceivedSeverity with NULL handle");
  outSev = CMGetPerceivedSeverity(cmpiError, &rc);
  if (!outSev)
  {
      PROV_LOG ("++++ (%s) CMGetPerceivedSeverity (%d)", strCMPIStatus (rc),
          outSev);
  }

  PROV_LOG ("Calling CMGetProbableCause with NULL handle");
  outPc = CMGetProbableCause(cmpiError, &rc);
  if (!outPc)
  {
      PROV_LOG ("++++ (%s) CMGetProbableCause (%d)", strCMPIStatus (rc),
          outPc);
  }

  PROV_LOG ("Calling CMGetProbableCauseDescription with NULL handle");
  outPcd = CMGetProbableCauseDescription(cmpiError, &rc);
  if (!outPcd)
  {
      PROV_LOG ("++++ (%s) CMGetProbableCauseDescription ",
          strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetRecommendedActions with NULL handle");
  outRecActions = CMGetRecommendedActions(cmpiError, &rc);
  if (!outRecActions)
  {
      PROV_LOG ("++++ (%s) CMGetRecommendedActions", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetErrorSource with NULL handle");
  outErrSource = CMGetErrorSource(cmpiError, &rc);
  if (!outErrSource)
  {
      PROV_LOG ("++++ (%s) CMGetErrorSource", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetErrorSourceFormat with NULL handle");
  outErrSourceFormat = CMGetErrorSourceFormat(cmpiError, &rc);
  if (!outErrSourceFormat)
  {
      PROV_LOG ("++++ (%s) CMGetErrorSourceFormat (%d)", strCMPIStatus (rc),
          outErrSourceFormat);
  }

  PROV_LOG ("Calling CMGetOtherErrorSourceFormat with NULL handle");
  outOtherErrSourceFormat = CMGetOtherErrorSourceFormat(cmpiError, &rc);
  if (!outOtherErrSourceFormat)
  {
      PROV_LOG ("++++ (%s) CMGetOtherErrorSourceFormat", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetCIMStatusCode with NULL handle");
  outCIMStatusCode = CMGetCIMStatusCode(cmpiError, &rc);
  if (!outCIMStatusCode)
  {
      PROV_LOG ("++++ (%s) CMGetCIMStatusCode (%d)", strCMPIStatus (rc),
          outCIMStatusCode);
  }

  PROV_LOG ("Calling CMGetCIMStatusCodeDescription with NULL handle");
  outCIMStatusCodeDesc = CMGetCIMStatusCodeDescription(cmpiError, &rc);
  if (!outCIMStatusCodeDesc)
  {
      PROV_LOG ("++++ (%s) CMGetCIMStatusCodeDescription", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMGetMessageArguments with NULL handle");
  outMsgArgs = CMGetMessageArguments(cmpiError, &rc);
  if (!outMsgArgs)
  {
      PROV_LOG ("++++ (%s) CMGetMessageArguments", strCMPIStatus (rc));
  }

  PROV_LOG ("Calling CMSetErrorType with NULL handle");
  rc = CMSetErrorType(cmpiError, inErrType);
  PROV_LOG ("++++ (%s) CMSetErrorType", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetOtherErrorType with NULL handle");
  rc = CMSetOtherErrorType(cmpiError, inOtherErrType);
  PROV_LOG ("++++ (%s) CMSetOtherErrorType", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetProbableCauseDescription with NULL handle");
  rc = CMSetProbableCauseDescription(cmpiError, inPcd);
  PROV_LOG ("++++ (%s) CMSetProbableCauseDescription", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetRecommendedActions with NULL handle");
  rc = CMSetRecommendedActions(cmpiError, inRecActions);
  PROV_LOG ("++++ (%s) CMSetRecommendedActions", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetErrorSource with NULL handle");
  rc = CMSetErrorSource(cmpiError, inErrSource);
  PROV_LOG ("++++ (%s) CMSetErrorSource", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetErrorSourceFormat with NULL handle");
  rc = CMSetErrorSourceFormat(cmpiError, inErrSourceFormat);
  PROV_LOG ("++++ (%s) CMSetErrorSourceFormat", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetOtherErrorSourceFormat with NULL handle");
  rc = CMSetOtherErrorSourceFormat(cmpiError, inOtherErrSourceFormat);
  PROV_LOG ("++++ (%s) CMSetOtherErrorSourceFormat", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetCIMStatusCodeDescription with NULL handle");
  rc = CMSetCIMStatusCodeDescription(cmpiError, inCIMStatusCodeDesc);
  PROV_LOG ("++++ (%s) CMSetCIMStatusCodeDescription", strCMPIStatus (rc));

  PROV_LOG ("Calling CMSetMessageArguments with NULL handle");
  rc = CMSetMessageArguments(cmpiError, inMsgArgs);
  PROV_LOG ("++++ (%s) CMSetMessageArguments", strCMPIStatus (rc));

  PROV_LOG_CLOSE();
  // Test case to increase coverage in CMPI_Broker.cpp
  objPath = CMNewObjectPath (_broker,
      "test/TestProvider",
      "TestCMPI_Method",
      &rc);
  retData = CBInvokeMethod(_broker,
      ctx,
      objPath,
      "testReturn",
      in,
      out,
      &rc);
  PROV_LOG_OPEN (_ClassName, _ProviderLocation);

  if(retData.value.uint32 == 2 && rc.rc == CMPI_RC_OK)
  {
      PROV_LOG ("++++ (%s) CMInvokeMethod", strCMPIStatus (rc));
  }
  PROV_LOG ("--- %s CMPI InvokeMethod() exited with CMPI_RC_ERR_FAILED", 
      _ClassName);
  PROV_LOG_CLOSE();
  CMReturnWithString(inCIMStatusCode, 
      CMNewString(_broker, "TestError invokeMethod() expected failure", NULL));
}
コード例 #13
0
// For Increasing the Coverage of CMPIInstance
static int _testInstance ()
{
    CMPIStatus rc = { CMPI_RC_OK, NULL };
    CMPIInstance* instance = NULL;
    CMPIObjectPath* objPath = NULL;
    CMPIObjectPath* objPathFake = NULL;

    CMPIValue value;
    CMPIType type = CMPI_uint64;

    CMPIData retData;
    CMPIData returnedData1;

    const char* property_name = "s";
    const char* origin = "origin";

    void* handle;

    int flag = 1;

    value.uint64 = PEGASUS_UINT64_LITERAL(5000000000);

    PROV_LOG("++++ _testInstance");

    objPath = make_ObjectPath(_broker, _Namespace, "TestCMPI_Instance");
    instance = make_Instance(objPath);

    /* Test cases to increase coverage in instSetPropertyWithOrigin function */

    /* Setting n64 property in class TestCMPI_Instance. So origin has been
       set to TestCMPI_Instance.*/
    rc = CMSetPropertyWithOrigin(instance,
        "n64",
        &value,
        type,
        "TestCMPI_Instance");
    if ( rc.rc == CMPI_RC_OK )
    {
        PROV_LOG("++++  SetPropertyWithOrigin for n64 property status : (%s)",
            strCMPIStatus(rc));
    }

    /* CMGetProperty is called to verify the value of the property just being
       set. */
    retData = CMGetProperty(instance, "n64", &rc);

    if (retData.type == CMPI_uint64 &&
           retData.value.uint64 == PEGASUS_UINT64_LITERAL(5000000000))
    {
         PROV_LOG("++++  CMGetProperty for n64 property status : (%s),"
             "value (%"PEGASUS_64BIT_CONVERSION_WIDTH"u)",
             strCMPIStatus(rc),
             retData.value.uint64);
    }

    /* Setting  non-member property of type CMPI_ref*/
    type= CMPI_ref;
    value.ref = objPath;

    rc = CMSetPropertyWithOrigin(instance, "objPath", &value, type, origin);
    if ( rc.rc == CMPI_RC_OK )
    {
        PROV_LOG("++++  SetPropertyWithOrigin status : (%s)",strCMPIStatus(rc));
    }

    /* Setting non-memeber property of type other than CMPI_ref*/
    value.uint32 = 32;
    type = CMPI_uint32;
    rc = CMSetPropertyWithOrigin(instance, "n32", &value, type, NULL);
    if ( rc.rc == CMPI_RC_OK )
    {
        PROV_LOG("++++  SetPropertyWithOrigin status : (%s)",strCMPIStatus(rc));
    }

    /* Testing error path for instGetProperty with NULL property name*/
    returnedData1 = CMGetProperty(instance, NULL, &rc);
    if (rc.rc == CMPI_RC_ERR_INVALID_PARAMETER )
    {
        PROV_LOG("++++ CMGetProperty with NULL property name status: (%s) ",
            strCMPIStatus(rc));
    }
    /*-----------------------------------------------------------------------*/

    /* Test cases to cover error paths for instSetObjectPath and
       instSetPropertyFilter*/

    /* Testing error path by passing CMPIObjectPath with class name different
       from the classname for CMPIInstance in CMSetObjectPath*/

    objPathFake = CMNewObjectPath(_broker,
        _Namespace,
        "TestCMPIInstance_Method",
        NULL);
    rc = CMSetObjectPath(instance, objPathFake);
    if ( rc.rc == CMPI_RC_ERR_FAILED || rc.rc == CMPI_RC_ERR_NOT_SUPPORTED)
    {
        PROV_LOG("++++  Test for CMSetObjectPath with wrong input passed");
    }

    /* Testing error path by passing NULL to instSetObjectPath*/
    rc = CMSetObjectPath(instance, NULL);
    if ( rc.rc == CMPI_RC_ERR_INVALID_PARAMETER ||
        rc.rc == CMPI_RC_ERR_NOT_SUPPORTED)
    {
        PROV_LOG("++++  Test for CMSetObjectPath with NULL input passed ");
    }

    /* Testing error paths by setting handle to CMPIInstance to NULL and using
       that in calls to instSetObjectPath and instSetPropertyFilter*/
    handle = instance->hdl;
    instance->hdl = NULL ;
    rc = CMSetObjectPath(instance, NULL);
    if ( rc.rc == CMPI_RC_ERR_INVALID_HANDLE ||
        rc.rc == CMPI_RC_ERR_NOT_SUPPORTED)
    {
        PROV_LOG("++++  CMSetObjectPath with NULL handle for"
            " CMPIInstance passed");
    }
    PROV_LOG("++++ CMSetObjectPath : (%s) ",strCMPIStatus(rc));

    rc = CMSetPropertyFilter(instance,&property_name,NULL);
    if( rc.rc == CMPI_RC_ERR_INVALID_HANDLE )
    {
        PROV_LOG("++++  CMSetPropertyFilter with NULL handle for CMPIInstance"
            " status : (%s)", strCMPIStatus (rc));
    }
    instance->hdl = handle;
    /*-----------------------------------------------------------------------*/
    return flag;

} // _testInstance end