Beispiel #1
0
/* 
   testGetInstance of the OS provider. 
*/
void OSTestClient::testGetInstance (CIMClient &client,
                                    Boolean verboseTest)
{
  CIMObjectPath  getTestRef;    //  will need an instance for Get
  
  try
    {
      Boolean deepInheritance = true;
      Boolean localOnly = true;
   
      testLog("OS Provider Test GetInstance");
     
      // first do an EnumerateInstanceNames - select one to play with 
      // doesn't hurt to keep testing enumerate :-)
 
      Array<CIMObjectPath> cimReferences = 
	    client.enumerateInstanceNames(NAMESPACE, CLASSNAME);
 
      Uint32 numberInstances = cimReferences.size();
      if (verboseTest)
	cout << numberInstances << " instances of PG_OperatingSystem" <<endl;

      for (Uint32 i = 0; i < cimReferences.size(); i++)
      {
         CIMName className = cimReferences[i].getClassName();
         if (!className.equal (CLASSNAME))
         {
	    errorExit("EnumInstanceNames failed - wrong class");
	 }
         // add in some content checks on the keys returned

         _validateKeys(cimReferences[i], verboseTest);

         // let's just take the first instance found
         getTestRef = cimReferences[i];

    }   // end for looping through instances
    
    if (verboseTest)
       cout<<"EnumerateInstanceNames for Get Instance completed"<<endl; 
   
    // now call GetInstance with the appropriate references
    CIMInstance getTestInstance = client.getInstance(NAMESPACE,
                                                     getTestRef);

    // now validate the properties returned
    _validateProperties(getTestInstance, verboseTest);

    testLog("OS Provider Test Get Instance passed ");
    }  // end try 
   
    catch(Exception& e)
    {
      errorExit(e.getMessage());
    }
}
Beispiel #2
0
/*
   testEnumerateInstanceNames of the NIS provider.
*/
void NISTestClient::testEnumerateInstanceNames(
    CIMClient &client,
    Boolean verboseTest)
{
    try
    {
        Uint32  numberInstances;

        testLog("NIS Provider Test Start EnumerateInstanceNames");

        Array<CIMObjectPath> cimReferences =
            client.enumerateInstanceNames(NAMESPACE, CLASS_NAME);

        numberInstances = cimReferences.size();
        if (verboseTest)
            cout << numberInstances << " instances of " <<
                CLASS_NAME.getString() <<endl;

        for (Uint32 i = 0; i < cimReferences.size(); i++)
        {
            CIMName className = cimReferences[i].getClassName();
            if (!className.equal(CLASS_NAME))
            {
                errorExit("EnumInstanceNames failed - wrong class");
            }

            _validateKeys(cimReferences[i], verboseTest);

        }   // end for looping through instances

        testLog("NIS Provider Test EnumInstanceNames Passed");
    }
    catch(Exception& e)
    {
        errorExit(e.getMessage());
    }
}