예제 #1
0
void _checkStringValue (CIMValue & theValue,
    const String & value,
    Boolean null = false)
{
    PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_STRING);
    PEGASUS_TEST_ASSERT (!theValue.isArray ());
    if (null)
    {
        PEGASUS_TEST_ASSERT (theValue.isNull ());
    }
    else
    {
        PEGASUS_TEST_ASSERT (!theValue.isNull ());
        String result;
        theValue.get (result);

        if (verbose)
        {
            if (result != value)
            {
                cerr << "Property value comparison failed.  ";
                cerr << "Expected " << value << "; ";
                cerr << "Actual property value was " << result << "." << endl;
            }
        }

        PEGASUS_TEST_ASSERT (result == value);
    }
}
예제 #2
0
void _checkStringProperty
  (CIMInstance & instance,
   const String & name, const String & value, Boolean null = false)
{
  Uint32 pos = instance.findProperty (name);
  PEGASUS_ASSERT (pos != PEG_NOT_FOUND);

  CIMProperty theProperty = instance.getProperty (pos);
  CIMValue theValue = theProperty.getValue ();

  PEGASUS_ASSERT (theValue.getType () == CIMTYPE_STRING);
  PEGASUS_ASSERT (!theValue.isArray ());
  if (null)
    {
      PEGASUS_ASSERT (theValue.isNull ());
    }
  else
    {
      PEGASUS_ASSERT (!theValue.isNull ());
      String result;
      theValue.get (result);

      if (verbose)
	{
	  if (result != value)
	    {
	      cerr << "Property value comparison failed.  ";
	      cerr << "Expected " << value << "; ";
	      cerr << "Actual property value was " << result << "." << endl;
	    }
	}

      PEGASUS_ASSERT (result == value);
    }
}
예제 #3
0
void _checkUint64Property
  (CIMInstance & instance, const String & name, Uint64 value)
{
  Uint32 pos = instance.findProperty (name);
  PEGASUS_ASSERT (pos != PEG_NOT_FOUND);

  CIMProperty theProperty = instance.getProperty (pos);
  CIMValue theValue = theProperty.getValue ();

  PEGASUS_ASSERT (theValue.getType () == CIMTYPE_UINT64);
  PEGASUS_ASSERT (!theValue.isArray ());
  PEGASUS_ASSERT (!theValue.isNull ());
  Uint64 result;
  theValue.get (result);

  if (verbose)
    {
      if (result != value)
	{
	  char buffer[32];	// Should need 21 chars max
	  sprintf (buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", value);
	  cerr << "Property value comparison failed.  ";
	  cerr << "Expected " << buffer << "; ";
	  sprintf (buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", result);
	  cerr << "Actual property value was " << buffer << "." << endl;
	}
    }

  PEGASUS_ASSERT (result == value);
}
예제 #4
0
void
test04 (CIMClient & client)
{
  CIMObjectPath instanceName;

  instanceName.setNameSpace (providerNamespace);
  instanceName.setClassName (CLASSNAME);

  Array < CIMParamValue > inParams;
  Array < CIMParamValue > outParams;

  /*     [EmbeddedObject] String returnInstance(); */

  CIMValue retValue = client.invokeMethod (providerNamespace,
                       instanceName,
                       "returnInstance",
                       inParams,
                       outParams);

  PEGASUS_TEST_ASSERT (retValue.getType () == CIMTYPE_OBJECT);
  PEGASUS_TEST_ASSERT (!retValue.isArray ());
  PEGASUS_TEST_ASSERT (!retValue.isNull ());

  CIMObject result;
  retValue.get (result);

  CIMObjectPath objPath  = result.getPath();
  PEGASUS_TEST_ASSERT (objPath.toString() == "TestCMPI_Instance");

}
void _checkUint16Property
  (CIMInstance & instance, const String & name, Uint16 value)
{
  Uint32 pos = instance.findProperty (name);
  PEGASUS_TEST_ASSERT (pos != PEG_NOT_FOUND);

  CIMProperty theProperty = instance.getProperty (pos);
  CIMValue theValue = theProperty.getValue ();

  PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_UINT16);
  PEGASUS_TEST_ASSERT (!theValue.isArray ());
  PEGASUS_TEST_ASSERT (!theValue.isNull ());
  Uint16 result;
  theValue.get (result);

  if (verbose)
    {
      if (result != value)
        {
          cerr << "Property value comparison failed.  ";
          cerr << "Expected " << value << "; ";
          cerr << "Actual property value was " << result << "." << endl;
        }
    }

  PEGASUS_TEST_ASSERT (result == value);
}
예제 #6
0
Array<String> CIMHelper::getPropertyAsStringArray(const CIMInstance &instanceObject, String name)
{
    CIMValue value = getPropertyValue(instanceObject, name);
    if (value.isNull()) return Array<String>();
    Array<String> result;
    value.get(result);
    return result;
}
예제 #7
0
Uint64 CIMHelper::getPropertyAsUint64(const CIMInstance &instanceObject, String name)
{
    CIMValue value = getPropertyValue(instanceObject, name);
    if (value.isNull()) return PEG_NOT_FOUND;
    Uint64 result;
    value.get(result);
    return result;
}
예제 #8
0
String CIMHelper::getPropertyAsString(const CIMInstance &instanceObject, String name)
{
    CIMValue value = getPropertyValue(instanceObject, name);
    if (value.isNull()) return String("");
    String result;
    value.get(result);
    return result;
}
void GetPropertyResponseHandler::deliver(const CIMValue& cimValue)
{
    if (cimValue.isNull())
    {
        MessageLoaderParms message(
            "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
            "The object is not initialized.");

        throw CIMException(CIM_ERR_FAILED, message);
    }

    SimpleValueResponseHandler::deliver(cimValue);
}
예제 #10
0
void CIMError::setInstance(const CIMInstance& instance)
{
    for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
    {
        CIMConstProperty p = instance.getProperty(i);

        _Check("ErrorType", p, (Uint16*)0);
        _Check("OtherErrorType", p, (String*)0);
        _Check("OwningEntity", p, (String*)0);
        _Check("MessageID", p, (String*)0);
        _Check("Message", p, (String*)0);
        _Check("MessageArguments", p, (Array<String>*)0);
        _Check("PerceivedSeverity", p, (Uint16*)0);
        _Check("ProbableCause", p, (Uint16*)0);
        _Check("ProbableCauseDescription", p, (String*)0);
        _Check("RecommendedActions", p, (Array<String>*)0);
        _Check("ErrorSource", p, (String*)0);
        _Check("ErrorSourceFormat", p, (Uint16*)0);
        _Check("OtherErrorSourceFormat", p, (String*)0);
        _Check("CIMStatusCode", p, (Uint32*)0);
        _Check("CIMStatusCodeDescription", p, (String*)0);
    }

    // Verify that the instance contains all of the required properties.

    for (Uint32 i = 0; i < _numRequiredProperties; i++)
    {
        // Does inst have this property?

        Uint32 pos = instance.findProperty(_requiredProperties[i]);

        if (pos == PEG_NOT_FOUND)
        {
            char buffer[80];
            sprintf(buffer, "required property does not exist: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
        }
        // is required property non-null?
        CIMConstProperty p = instance.getProperty(pos);
        CIMValue v = p.getValue();
        if (v.isNull())
        {
            char buffer[80];
            sprintf(buffer, "required property MUST NOT be Null: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_FAILED, buffer);
        }
    }
    _inst = instance;
}
예제 #11
0
void MethodProvider::invokeMethod(
    const OperationContext & context,
    const CIMObjectPath & objectReference,
    const CIMName & methodName,
    const Array<CIMParamValue> & inParameters,
    MethodResultResponseHandler & handler)
{
    // convert a fully qualified reference into a local reference
    // (class name and keys only).
    CIMObjectPath localReference = CIMObjectPath(
        String(),
        CIMNamespaceName(),
        objectReference.getClassName(),
        objectReference.getKeyBindings());

    handler.processing();

    if (objectReference.getClassName().equal("Sample_MethodProviderClass"))
    {
        if (methodName.equal("SayHello"))
        {
            String outString = "Hello";
            if (inParameters.size() > 0)
            {
                CIMValue paramVal = inParameters[0].getValue();
                if (!paramVal.isNull())
                {
                    String replyName;
                    paramVal.get(replyName);
                    if (replyName != String::EMPTY)
                    {
                        outString.append(", " + replyName + "!");
                    }
                }

                handler.deliverParamValue(
                    CIMParamValue("Place",
                        CIMValue(String("From Neverland"))));
                handler.deliver(CIMValue(outString));
            }
            else
            {
                handler.deliver(CIMValue(outString));
            }
        }
    }
    
    handler.complete();
}
예제 #12
0
void _checkUint32Value (CIMValue & theValue, Uint32 value)
{
    PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_UINT32);
    PEGASUS_TEST_ASSERT (!theValue.isArray ());
    PEGASUS_TEST_ASSERT (!theValue.isNull ());

    Uint32 result;
    theValue.get (result);

    if (verbose)
    {
        if (result != value)
        {
            cerr << "Property value comparison failed.  ";
            cerr << "Expected " << value << "; ";
            cerr << "Actual property value was " << result << "." << endl;
        }
    }

    PEGASUS_TEST_ASSERT (result == value);
}
예제 #13
0
void
test05 (CIMClient & client)
{
  CIMObjectPath instanceName;

  instanceName.setNameSpace (providerNamespace);
  instanceName.setClassName (CLASSNAME);

  Array < CIMParamValue > inParams;
  Array < CIMParamValue > outParams;

  /*     String returnDateTime(); */

  CIMValue retValue = client.invokeMethod (providerNamespace,
                       instanceName,
                       "returnDateTime",
                       inParams,
                       outParams);
  PEGASUS_TEST_ASSERT (retValue.getType () == CIMTYPE_DATETIME);
  PEGASUS_TEST_ASSERT (!retValue.isArray ());
  PEGASUS_TEST_ASSERT (!retValue.isNull ());

}
예제 #14
0
/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::createInstance
//
// ///////////////////////////////////////////////////////////////////////////
CIMObjectPath WMIInstanceProvider::createInstance(
        const String& nameSpace,
        const String& userName,
        const String& password,
        const CIMInstance& newInstance)
{
    PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIInstanceProvider::createInstance()");

    HRESULT hr;
    CComPtr<IWbemClassObject>    pClass;
    CComPtr<IWbemClassObject>    pNewInstance;
    CComBSTR bs;

    setup(nameSpace, userName, password);

    PEG_TRACE((TRC_WMIPROVIDER,
                  Tracer::LEVEL3,
                  "createInstance() - nameSpace %s, userName %s",
                  nameSpace.getCString(),
                  userName.getCString()));

    if (!m_bInitialized)
    {
        throw CIMException(CIM_ERR_FAILED);
    }

    // Get the class definition.
    String className = newInstance.getClassName().getString();

    if (!(_collector->getObject(&pClass, className)))
    {
        if (pClass)
            pClass.Release();

        throw CIMException(CIM_ERR_INVALID_CLASS);
    }
    else if (_collector->isInstance(pClass))
    {
        if (pClass)
            pClass.Release();

        throw CIMException(CIM_ERR_INVALID_PARAMETER);
    }

    // Create a new instance.
    hr = pClass->SpawnInstance(0, &pNewInstance);

    if (pClass)
        pClass.Release();

    if(FAILED(hr))
    {
        throw CIMException(CIM_ERR_FAILED);
    }

    // Set the properties
    for(Uint32 i = 0; i < newInstance.getPropertyCount(); i++)
    {
        CComVariant v;

        CIMProperty property = newInstance.getProperty(i).clone();
        CIMValue propertyValue = property.getValue();

        try
        {
            WMIValue(propertyValue).getAsVariant(
                                        &v,
                                        nameSpace,
                                        userName,
                                        password);
        }
        catch (CIMException&)
        {
            if (pNewInstance)
                pNewInstance.Release();

            v.Clear();

            throw;
        }

        bs.Empty();
        bs = property.getName().getString().getCString();

        // NULL properties in causes a CIM_ERR_FAILED
        // this conditional ignores properties with NULL.
        if (!propertyValue.isNull())
            hr = pNewInstance->Put(bs, 0, &v, 0);

        v.Clear();

        if(FAILED(hr))
        {
            if (pNewInstance)
                pNewInstance.Release();

            throw CIMException(CIM_ERR_FAILED);
        }
    }

    // Connect to the server
    CComPtr<IWbemServices>    pServices;
    bool bConnected = _collector->Connect(&pServices);

    if (!bConnected)
    {
        throw CIMException(CIM_ERR_ACCESS_DENIED);
    }

    // Write the instance to WMI.
    CComPtr<IWbemCallResult> pResult;

    hr = pServices->PutInstance(pNewInstance,
                                WBEM_FLAG_RETURN_IMMEDIATELY |
                                WBEM_FLAG_CREATE_ONLY |
                                WBEM_FLAG_USE_AMENDED_QUALIFIERS,
                                NULL,
                                &pResult);

    if (pNewInstance)
        pNewInstance.Release();

    if (pServices)
        pServices.Release();


    // set proxy security on pResult
    bool bSecurity = _collector->setProxySecurity(pResult);


    //check for error
    pResult->GetCallStatus(WBEM_INFINITE, &hr);
    if(FAILED(hr))
    {
        switch(hr)
        {
            case E_ACCESSDENIED:
                throw CIMException(CIM_ERR_ACCESS_DENIED);
                break;
            case WBEM_E_ACCESS_DENIED:
                throw CIMException(CIM_ERR_ACCESS_DENIED);
                break;
            case WBEM_E_ALREADY_EXISTS:
                throw CIMException(CIM_ERR_ALREADY_EXISTS);
                break;
            case WBEM_E_INVALID_CLASS:
                throw CIMException(CIM_ERR_INVALID_CLASS);
                break;
            case WBEM_E_NOT_FOUND:
                throw CIMException(CIM_ERR_NOT_FOUND);
                break;
            default:
                throw CIMException(CIM_ERR_FAILED);
        }
    }


    // Mount the path to return

    // Prepend namespace to path
    String sPath = "//";

    // Append the host name if it is local
    if(_collector->isLocalNamespace())
    {
        sPath.append(getHostName());
        sPath.append("/");
    }

    // Append the namespace, colon
    sPath.append(nameSpace);
    sPath.append(":");

    // Get the key bindings
    CComBSTR bsKeyBindings;
    hr = pResult->GetResultString(WBEM_INFINITE, &bsKeyBindings);

    if (pResult)
        pResult.Release();

    if(FAILED(hr))
    {
        switch(hr)
        {
            case E_ACCESSDENIED:
                throw CIMException(CIM_ERR_ACCESS_DENIED);
                break;
            case WBEM_E_ACCESS_DENIED:
                throw CIMException(CIM_ERR_ACCESS_DENIED);
                break;
            case WBEM_E_INVALID_OPERATION:
                // GetResultString() may fail on Win2K - get the keys
                // from the CIM instance:
                if (!GetKeyBindingsFromCIMInstance(newInstance,
                    &bsKeyBindings))
                    throw CIMException(CIM_ERR_NOT_SUPPORTED);
                break;
            default:
                throw CIMException(CIM_ERR_FAILED);
        }
    }

    // Append the key bindings to the path
    bs.Empty();
    bs = sPath.getCString();
    bs.Append(bsKeyBindings);
    bsKeyBindings.Empty();

    // Return the CIMObjectPath

    PEG_METHOD_EXIT();

    CMyString s; s = bs;
    return CIMObjectPath(String((LPCTSTR)s));
 }
예제 #15
0
Boolean _applyProjection(QueryExpression& qe,
                         Array<CIMInstance>& _instances,
                         String testOption,
                         String lang)
{
    if(testOption == String::EMPTY || testOption == "2")
    {
        cout << endl << lang << " ========Apply Projection Results========" << endl;
        cout << qe.getQuery() << endl;

        for(Uint32 j = 0; j < _instances.size(); j++)
        {
            cout << "Instance of class " << _instances[j].getClassName().getString() << endl;

            try
            {
                CIMInstance projInst = _instances[j].clone();

                Boolean gotPropExc = false;
                try
                {
                    qe.applyProjection(projInst, false);
                }
                catch (QueryRuntimePropertyException & qrpe)
                {
                    // Got a missing property exception.
                    cout << "-----" << qrpe.getMessage() << endl;
                    gotPropExc = true;
                }

                if (gotPropExc)
                {
                    // Got a missing property exception.
                    // Try again, allowing missing properties.
                    // Need to use a cloned instance because the original instance
                    // was partially projected.
                    cout << "Instance of class " << _instances[j].getClassName().getString()
                         << ".  Allow missing properties." << endl;
                    projInst = _instances[j].clone();
                    qe.applyProjection(projInst, true);
                }

                Uint32 cnt = projInst.getPropertyCount();
                if (cnt == 0)
                {
                    cout << "-----No properties left after projection" << endl;
                }

                if (cnt > 10)
                {
                    // If more than 10 props, just print the count to keep
                    // the output file short
                    cout << "Instance has " << cnt << " properties" << endl;
                }
                else
                {
                    for (Uint32 n = 0; n < cnt; n++)
                    {
                        CIMProperty prop = projInst.getProperty(n);
                        CIMValue val = prop.getValue();
                        cout << "-----Prop #" << n << " Name = " << prop.getName().getString();
                        if (val.isNull())
                        {
                            cout << " Value = NULL" << endl;
                        }
                        else
                        {
                            cout << " Value = " << val.toString() << endl;
                        }
                    }
                }
            }
            catch(Exception& e) {
                cout << "-----" << e.getMessage() << endl;
            }
            catch(...) {
                cout << "Unknown Exception" << endl;
            }

        }
    }

    return true;
}
void EmailListenerDestination::handleIndication(
    const OperationContext& context,
    const String nameSpace,
    CIMInstance& indication,
    CIMInstance& handler,
    CIMInstance& subscription,
    ContentLanguages & contentLanguages)
{
    PEG_METHOD_ENTER (TRC_IND_HANDLER,
                      "EmailListenerDestination::handleIndication");

    String indicationText;

    try
    {
        // gets formatted indication message
        indicationText = IndicationFormatter::getFormattedIndText(
                             subscription, indication, contentLanguages);

        // get MailTo from handler instance
        Array<String> mailTo;
        handler.getProperty(handler.findProperty(
                                PEGASUS_PROPERTYNAME_LSTNRDST_MAILTO)).getValue().get(mailTo);

        // get MailSubject from handler instance
        String mailSubject = String::EMPTY;
        handler.getProperty(handler.findProperty(
                                PEGASUS_PROPERTYNAME_LSTNRDST_MAILSUBJECT)).getValue().get(
                                    mailSubject);

        // get MailCc from handler instance
        CIMValue mailCcValue;
        Array<String> mailCc;

        Uint32 posMailCc = handler.findProperty(
                               PEGASUS_PROPERTYNAME_LSTNRDST_MAILCC);

        if (posMailCc != PEG_NOT_FOUND)
        {
            mailCcValue = handler.getProperty(posMailCc).getValue();
        }

        if (!mailCcValue.isNull())
        {
            if ((mailCcValue.getType() == CIMTYPE_STRING) &&
                    (mailCcValue.isArray()))
            {
                mailCcValue.get(mailCc);
            }
        }

        // Sends the formatted indication to the specified recipients
        _sendViaEmail(mailTo, mailCc, mailSubject, indicationText);

    }
    catch (CIMException & c)
    {
        PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, c.getMessage());
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, c.getMessage());
    }
    catch (Exception& e)
    {
        PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, e.getMessage());
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, e.getMessage());
    }
    catch (...)
    {
        PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4,
                         "Failed to deliver indication via e-mail.");
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,
                                       MessageLoaderParms("Handler.EmailListenerDestination."
                                               "EmailListenerDestination.FAILED_TO_DELIVER_INDICATION_VIA_EMAIL",
                                               "Failed to deliver indication via e-mail."));
    }

    PEG_METHOD_EXIT();
}
예제 #17
0
void InteropProvider::initProvider()
{
    if(providerInitialized)
        return;
    // Placed METHOD_ENTER trace statement after checking whether the
    // provider is initialized because this method will be called for every
    // operation through the InteropProvider, and this method is only
    // interesting the first time it is successfully run.
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "InteropProvider::initProvider()");

    AutoMutex lock(interopMut);
    if(!providerInitialized)
    {
        //
        // Initialize the object manager instance for the CIM Server, and
        // retrieve the object manager's name property. This is retrieved once
        // and stored for use in constructing other instances requiring its
        // value.
        //
        CIMInstance objectManager = getObjectManagerInstance();
        objectManager.getProperty(objectManager.findProperty(
            OM_PROPERTY_NAME)).getValue().get(objectManagerName);

        //
        // Determine whether the CIMOM should be gathering statistical data
        // based on the GatherStatisticalData property in the object manager.
        //
        Uint32 gatherDataIndex = objectManager.findProperty(
            OM_PROPERTY_GATHERSTATISTICALDATA);
        if(gatherDataIndex != PEG_NOT_FOUND)
        {
            CIMConstProperty gatherDataProp =
                objectManager.getProperty(gatherDataIndex);
            if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
            {
                CIMValue gatherDataVal  = gatherDataProp.getValue();
                if (!gatherDataVal.isNull())
                {
                    Boolean gatherData;
                    gatherDataVal.get(gatherData);
                    if (gatherData == true)
                    {
                        StatisticalData* sd = StatisticalData::current();
                        sd->setCopyGSD(true);
                    }
                }
            }
        }

        // Cache this class definition for use later.
        profileCapabilitiesClass = repository->getClass(
            PEGASUS_NAMESPACENAME_INTEROP,
            PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
            false,
            true,
            false);

        providerClassifications.append(Uint16(5)); // "Instrumentation"

        // initialize namespaces.
        initializeNamespaces();

        // Now cache the Registration info used for ElementConformsToProfile
        cacheProfileRegistrationInfo();

        providerInitialized = true;
    }
    PEG_METHOD_EXIT();
}
예제 #18
0
int testClass(const String& className)
{
  Array<CIMObjectPath> refs;

  cout << endl << "+++++ Testing Class " << className << " +++++" << endl;

  // =======================================================================
  // enumerateInstanceNames
  // =======================================================================

  cout << "+++++ enumerateInstanceNames(" << className << "): ";
  try
  {
    refs = c.enumerateInstanceNames(NAMESPACE,className);
  }
  catch (Exception& e)
  {
    cout << endl;
    errorExit(e);
  }

  cout << refs.size() << " instances" << endl;

  // There must be at least 5 processes or something's wrong
  if (refs.size() < 5)
  {
    cout << "+++++ Error: too few instances returned" << endl;
    return 1;
  }

  // =======================================================================
  // getInstance
  // =======================================================================

  // -------------------- First do normal getInstance() --------------------

  // pick the middle instance of the bunch
  Uint32 i = (refs.size()-1) >> 1;  // This is a shift right, not streamio!
  CIMObjectPath ref = refs[i];
  CIMInstance inst;
  cout << "+++++ getInstance " << i << endl;
  try
  {
    inst = c.getInstance(NAMESPACE,ref);
  }
  catch (Exception& e)
  {
    errorExit(e);
  }

  if (processTestVerbose)
  {
    // Display keys
    Array<CIMKeyBinding> keys = ref.getKeyBindings();
    cout << "  Keys:" << endl;
    for (i=0; i<keys.size(); i++)
      cout << "    " << keys[i].getName() << " = " << keys[i].getValue() << endl;
  }

  // check returned property values

  // first get the PID and load a process object
  String handle;
  inst.getProperty(inst.findProperty("handle")).getValue().get(handle);
  Process p;
  // error if can't get the process
  if (!p.findProcess(handle))
  {
    cout << "+++++ Error: can't find process corresponding to instance" << endl;
    return 1;
  }

  if (processTestVerbose) cout << "  Properties:" << endl;

  String sa, sb;
  Array<String> asa, asb;
  Uint16 i16a, i16b;
  Uint32 i32a, i32b;
  Uint64 i64a, i64b;
  CIMDateTime da, db;
  
  // For each property, get it from the just-loaded process
  // object and compare with what was returned by getInstance()

  // Caption and Description are common to all classes
  if (p.getCaption(sa))
  {
    if (processTestVerbose) cout << "    Caption" << endl;
    inst.getProperty(inst.findProperty("Caption")).getValue().get(sb);
    if (sa != sb)
    {
      cout << "+++++ Error: property mismatch: Caption" << endl;
      return 1;
    }
  }
  
  if (p.getDescription(sa))
  {
    if (processTestVerbose) cout << "    Description" << endl;
    inst.getProperty(inst.findProperty("Description")).getValue().get(sb);
    if (sa != sb)
    {
      cout << "+++++ Error: property mismatch: Description" << endl;
      return 1;
    }
  }
  
  // The rest of the properties to check depend on the
  // class we are testing

  // ===================== UnixProcess instances =========================

  if (String::equalNoCase(className,"CIM_Process") ||
      String::equalNoCase(className,"PG_UnixProcess"))
  {
    if (p.getInstallDate(da))
    {
      if (processTestVerbose) cout << "    InstallDate" << endl;
      inst.getProperty(inst.findProperty("InstallDate")).getValue().get(db);
      if (da != db)
      {
        cout << "+++++ Error: property mismatch: InstallDate" << endl;
        return 1;
      }
    }
  
    if (p.getStatus(sa))
    {
      if (processTestVerbose) cout << "    Status" << endl;
      inst.getProperty(inst.findProperty("Status")).getValue().get(sb);
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: Status" << endl;
        return 1;
      }
    }
  
    if (p.getName(sa))
    {
      if (processTestVerbose) cout << "    Name" << endl;
      inst.getProperty(inst.findProperty("Name")).getValue().get(sb);
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: Name" << endl;
        return 1;
      }
    }
  
    if (p.getPriority(i32a))
    {
      if (processTestVerbose) cout << "    Priority" << endl;
      inst.getProperty(inst.findProperty("Priority")).getValue().get(i32b);
      if (i32a != i32b)
      {
        cout << "+++++ Error: property mismatch: Priority" << endl;
        return 1;
      }
    }
  
    if (p.getExecutionState(i16a))
    {
      if (processTestVerbose) cout << "    ExecutionState" << endl;
      inst.getProperty(inst.findProperty("ExecutionState")).getValue().get(i16b);
      if (i16a != i16b)
      {
        cout << "+++++ Error: property mismatch: ExecutionState" << endl;
        return 1;
      }
    }
  
    if (p.getOtherExecutionDescription(sa))
    {
      if (processTestVerbose) cout << "    OtherExecutionDescription" << endl;
      CIMValue oedVal = inst.getProperty
          (inst.findProperty("OtherExecutionDescription")).getValue();
      if (!oedVal.isNull())
          oedVal.get(sb);
      else
         sb = String::EMPTY;
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: OtherExecutionDescription" << endl;
        return 1;
      }
    }
  
    if (p.getCreationDate(da))
    {
      if (processTestVerbose) cout << "    CreationDate" << endl;
      inst.getProperty(inst.findProperty("CreationDate")).getValue().get(db);
      if (da != db)
      {
        cout << "+++++ Error: property mismatch: CreationDate" << endl;
        return 1;
      }
    }
  
    if (p.getTerminationDate(da))
    {
      if (processTestVerbose) cout << "    TerminationDate" << endl;
      inst.getProperty(inst.findProperty("TerminationDate")).getValue().get(db);
      if (da != db)
      {
        cout << "+++++ Error: property mismatch: TerminationDate" << endl;
        return 1;
      }
    }
  
    if (p.getKernelModeTime(i64a))
    {
      if (processTestVerbose) cout << "    KernelModeTime" << endl;
      inst.getProperty(inst.findProperty("KernelModeTime")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: KernelModeTime" << endl;
        return 1;
      }
    }
  
    if (p.getUserModeTime(i64a))
    {
      if (processTestVerbose) cout << "    UserModeTime" << endl;
      inst.getProperty(inst.findProperty("UserModeTime")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: UserModeTime" << endl;
        return 1;
      }
    }
  
    if (p.getWorkingSetSize(i64a))
    {
      if (processTestVerbose) cout << "    WorkingSetSize" << endl;
      inst.getProperty(inst.findProperty("WorkingSetSize")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: WorkingSetSize" << endl;
        return 1;
      }
    }
  
    if (p.getParentProcessID(sa))
    {
      if (processTestVerbose) cout << "    ParentProcessID" << endl;
      inst.getProperty(inst.findProperty("ParentProcessID")).getValue().get(sb);
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: ParentProcessID" << endl;
        return 1;
      }
    }
  
    if (p.getRealUserID(i64a))
    {
      if (processTestVerbose) cout << "    RealUserID" << endl;
      inst.getProperty(inst.findProperty("RealUserID")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: RealUserID" << endl;
        return 1;
      }
    }
  
    if (p.getProcessGroupID(i64a))
    {
      if (processTestVerbose) cout << "    ProcessGroupID" << endl;
      inst.getProperty(inst.findProperty("ProcessGroupID")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: ProcessGroupID" << endl;
        return 1;
      }
    }
  
    if (p.getProcessSessionID(i64a))
    {
      if (processTestVerbose) cout << "    ProcessSessionID" << endl;
      inst.getProperty(inst.findProperty("ProcessSessionID")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: ProcessSessionID" << endl;
        return 1;
      }
    }
  
    if (p.getProcessTTY(sa))
    {
      if (processTestVerbose) cout << "    ProcessTTY" << endl;
      inst.getProperty(inst.findProperty("ProcessTTY")).getValue().get(sb);
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: ProcessTTY" << endl;
        return 1;
      }
    }
  
    if (p.getModulePath(sa))
    {
      if (processTestVerbose) cout << "    ModulePath" << endl;
      inst.getProperty(inst.findProperty("ModulePath")).getValue().get(sb);
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: ModulePath" << endl;
        return 1;
      }
    }
  
    if (p.getParameters(asa))
    {
      if (processTestVerbose) cout << "    Parameters" << endl;
      inst.getProperty(inst.findProperty("Parameters")).getValue().get(asb);
      if (asa != asb)
      {
        cout << "+++++ Error: property mismatch: Parameters" << endl;
        return 1;
      }
    }
  
    if (p.getProcessNiceValue(i32a))
    {
      if (processTestVerbose) cout << "    ProcessNiceValue" << endl;
      inst.getProperty(inst.findProperty("ProcessNiceValue")).getValue().get(i32b);
      if (i32a != i32b)
      {
        cout << "+++++ Error: property mismatch: ProcessNiceValue" << endl;
        return 1;
      }
    }
  
    if (p.getProcessWaitingForEvent(sa))
    {
      if (processTestVerbose) cout << "    ProcessWaitingForEvent" << endl;
      inst.getProperty(inst.findProperty("ProcessWaitingForEvent")).getValue().get(sb);
      if (sa != sb)
      {
        cout << "+++++ Error: property mismatch: ProcessWaitingForEvent" << endl;
        return 1;
      }
    }
    cout << "+++++ property values ok" << endl;
  }

  // ========== UnixProcessStatisticalInformation instances ===============

  else if (String::equalNoCase(className,"PG_UnixProcessStatisticalInformation"))
  {
    if (p.getCPUTime(i32a))
    {
      if (processTestVerbose) cout << "    CPUTime" << endl;
      inst.getProperty(inst.findProperty("CPUTime")).getValue().get(i32b);
      if (i32a != i32b)
      {
        cout << "+++++ Error: property mismatch: CPUTime" << endl;
        return 1;
      }
    }
  
    if (p.getRealText(i64a))
    {
      if (processTestVerbose) cout << "    RealText" << endl;
      inst.getProperty(inst.findProperty("RealText")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: RealText" << endl;
        return 1;
      }
    }
  
    if (p.getRealData(i64a))
    {
      if (processTestVerbose) cout << "    RealData" << endl;
      inst.getProperty(inst.findProperty("RealData")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: RealData" << endl;
        return 1;
      }
    }
  
    if (p.getRealStack(i64a))
    {
      if (processTestVerbose) cout << "    RealStack" << endl;
      inst.getProperty(inst.findProperty("RealStack")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: RealStack" << endl;
        return 1;
      }
    }
  
    if (p.getVirtualText(i64a))
    {
      if (processTestVerbose) cout << "    VirtualText" << endl;
      inst.getProperty(inst.findProperty("VirtualText")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: VirtualText" << endl;
        return 1;
      }
    }
  
    if (p.getVirtualData(i64a))
    {
      if (processTestVerbose) cout << "    VirtualData" << endl;
      inst.getProperty(inst.findProperty("VirtualData")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: VirtualData" << endl;
        return 1;
      }
    }
  
    if (p.getVirtualStack(i64a))
    {
      if (processTestVerbose) cout << "    VirtualStack" << endl;
      inst.getProperty(inst.findProperty("VirtualStack")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: VirtualStack" << endl;
        return 1;
      }
    }
  
    if (p.getVirtualMemoryMappedFileSize(i64a))
    {
      if (processTestVerbose) cout << "    VirtualMemoryMappedFileSize" << endl;
      inst.getProperty(inst.findProperty("VirtualMemoryMappedFileSize")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: VirtualMemoryMappedFileSize" << endl;
        return 1;
      }
    }
  
    if (p.getVirtualSharedMemory(i64a))
    {
      if (processTestVerbose) cout << "    VirtualSharedMemory" << endl;
      inst.getProperty(inst.findProperty("VirtualSharedMemory")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: VirtualSharedMemory" << endl;
        return 1;
      }
    }
  
    if (p.getCpuTimeDeadChildren(i64a))
    {
      if (processTestVerbose) cout << "    CpuTimeDeadChildren" << endl;
      inst.getProperty(inst.findProperty("CpuTimeDeadChildren")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: CpuTimeDeadChildren" << endl;
        return 1;
      }
    }

    if (p.getSystemTimeDeadChildren(i64a))
    {
      if (processTestVerbose) cout << "    SystemTimeDeadChildren" << endl;
      inst.getProperty(inst.findProperty("SystemTimeDeadChildren")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: SystemTimeDeadChildren" << endl;
        return 1;
      }
    }
  
    if (p.getRealSpace(i64a))
    {
      if (processTestVerbose) cout << "    RealSpace" << endl;
      inst.getProperty(inst.findProperty("RealSpace")).getValue().get(i64b);
      if (i64a != i64b)
      {
        cout << "+++++ Error: property mismatch: RealSpace" << endl;
        return 1;
      }
    }
  
    cout << "+++++ property values ok" << endl;
  }
  
  else
  {
    cout << "+++++ Error: class " << className << " not recognized" << endl;
    return 1;
  }

  // ------------------ do getInstance() with bad key ----------------------
  
  Array<CIMKeyBinding> kb = ref.getKeyBindings();
  // mess up first key name
  kb[0].setName("foobar");
  ref.setKeyBindings(kb);
  
  int status = 0;

  cout << "+++++ getInstance with bad key" << endl;
  try
  {
    inst = c.getInstance(NAMESPACE,ref);
  }
  catch (CIMException& e)
  {
    if (e.getCode() == CIM_ERR_INVALID_PARAMETER) status = 1;
  }
  catch (Exception& e)
  {
    // any other exception is a failure; leave status alone
  }
  if (status == 0)
  {
    cout << "+++++ Error: bad instance name not rejected" << endl;
    return 1;
  }

  // =======================================================================
  // createInstance
  // =======================================================================

  CIMObjectPath ref2;
  cout << "+++++ createInstance" << endl;
  status = 0;
  try
  {
    ref2 = c.createInstance(NAMESPACE,inst);
  }
  catch (CIMException& e)
  {
    if (e.getCode() == CIM_ERR_NOT_SUPPORTED) status = 1;
  }
  catch (Exception& e)
  {
    // any other Exception is a problem; leave status alone
  }
  if (status == 0)
  {
    cout << "+++++ Error: createInstance didn't throw exception" << endl;
    return 1;
  }

  // =======================================================================
  // deleteInstance
  // =======================================================================

  cout << "+++++ deleteInstance" << endl;
  status = 0;
  try
  {
    c.deleteInstance(NAMESPACE,ref);
  }
  catch (CIMException& e)
  {
    if (e.getCode() == CIM_ERR_NOT_SUPPORTED) status = 1;
  }
  catch (Exception& e)
  {
    // any other Exception is a problem; leave status alone
  }
  if (status == 0)
  {
    cout << "+++++ Error: deleteInstance didn't throw exception" << endl;
    return 1;
  }

  // =======================================================================
  // enumerateInstances
  // =======================================================================

  cout << "+++++ enumerateInstances(" << className << ")" << endl;
  
  Array<CIMInstance> ia;
  try
  {
    ia = c.enumerateInstances(NAMESPACE,className);
  }
  catch (Exception& e)
  {
    errorExit(e);
  }

  // There should be several instances
  if (ia.size() < 5)
  {
    cout << "+++++ Error: enumerateInstances on " << className << " returned too few instances" << endl;
    return 1;
  }
  
  // For UnixProcess, we should be able to find this test process
  // and the cimserver
  if (String::equalNoCase(className,"CIM_Process") ||
      String::equalNoCase(className,"PG_UnixProcess"))
  {
    status = 0;
    for (i=0; i<ia.size(); i++)
    {
      Array<String> cmd;
      ia[i].getProperty(ia[i].findProperty("Parameters")).getValue().get(cmd);
      if (cmd[0] == "cimserver")
      {
        status++;
        if (processTestVerbose) cout << "    cimserver" << endl;
      }
      if (cmd[0] == "ProcessProviderTestClient")
      {
        status++;
        if (processTestVerbose) cout << "    ProcessProviderTestClient" << endl;
      }
    }
    if (status < 2)
    {
      cout << "Error: couldn't find cimserver or test client process!" << endl;
      return 1;
    }
  }

  // =======================================================================
  // modifyInstance
  // =======================================================================

  // We do modifyInstance after enumerateInstances, because
  // modifyInstance requires a CIMInstance argument, which
  // is conveniently what was returned by enumerateInstances

  CIMInstance ni = ia[(ia.size()-1) >> 1]; // pick the middle one

  cout << "+++++ modifyInstance" << endl;
  status = 0;
  try
  {
    c.modifyInstance(NAMESPACE,ni);
  }
  catch (CIMException& e)
  {
    if (e.getCode() == CIM_ERR_NOT_SUPPORTED) status = 1;
  }
  catch (Exception& e)
  {
    // any other Exception is a problem; leave status alone
  }
  if (status == 0)
  {
    cout << "+++++ Error: modifyInstance didn't throw exception" << endl;
    return 1;
  }

  // =======================================================================
  // Tests completed
  // =======================================================================

  return 0;
}
/*
    Get the value of the defined property (including looping through
    chained properties) and convert that value to an FQLOperand.
*/
Boolean FQLInstancePropertySource::getValue(
    const String& propertyName,
    FQLOperand& value) const
{
    CIMValue val;
    CIMType type;

#ifdef ENABLE_LOCAL_DIAGNOSTICS
    DCOUT << "getValue " << propertyName << " isChained "
          << boolToString(value.isChained()) << endl;
#endif
    // if dotted property, return the embedded instance or false if
    // the value is NOT an instance.
    if (value.isChained())
    {
        if (!_getPropertyValue(ci, propertyName, val))
        {
            // Property could not be found, return false.
            return false;
        }
        type=val.getType();

        if (type != CIMTYPE_INSTANCE)
        {
            return false;
        }
        else
        {
            CIMInstance ciLocal;
            val.get(ciLocal);
            if (value.isChained())
            {
                PEGASUS_ASSERT(value.chainSize() != 0);

                // If this property is chained, resolve the property chain
                FQLOperand x;
                Uint32 chainSize = value.chainSize();
                Uint32 lastEntry = chainSize - 1;

                for (Uint32 i = 0; i < chainSize; i++)
                {
                    // Get chained operand and get name from it
                    x = value.chainItem(i);
                    String pName  = x.getPropertyName();

                    // Get name from the chain item
                    if (!_getPropertyValue(ciLocal, pName, val))
                    {
                        // Property could not be found, return false.
                        return false;
                    }
                    type=val.getType();

                    if (type == CIMTYPE_INSTANCE)
                    {
                        if (i == lastEntry)
                        {
                            return false;
                        }
                        else
                        {
                            val.get(ciLocal);
                        }
                    }
                    else
                    {
                        if (i != lastEntry)
                        {
                            return false;
                        }
                    }
                }
            }
        }
    }
    else
    {
        unsigned int pos=ci.findProperty(propertyName);
        if (pos==PEG_NOT_FOUND)
        {
            // Property could not be found, return false.
            return false;
        }

        val=ci.getProperty(pos).getValue();
        type=val.getType();
    }

    if (val.isNull())
    {
        value=FQLOperand();
        return true;
    }

    if (val.isArray())
    {
        switch (type)
        {
        case CIMTYPE_UINT8:
        {
            Array<Uint8> propertyValueUint8;
            val.get(propertyValueUint8);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueUint8.size(); i++)
            {
                propertyValueSint64.append((Sint64)propertyValueUint8[i]);
            }
            value = FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_UINT16:
        {
            Array<Uint16> propertyValueUint16;
            val.get(propertyValueUint16);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueUint16.size(); i++)
            {
                propertyValueSint64.append((Sint64)propertyValueUint16[i]);
            }
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_UINT32:
        {
            Array<Uint32> propertyValueUint32;
            val.get(propertyValueUint32);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueUint32.size(); i++)
            {
                propertyValueSint64.append((Sint64)propertyValueUint32[i]);
            }
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_UINT64:
        {
            Array<Uint64> propertyValueUint64;
            val.get(propertyValueUint64);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueUint64.size(); i++)
            {
                propertyValueSint64.append((Sint64)propertyValueUint64[i]);
            }
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_SINT8:
        {
            Array<Sint8> propertyValueSint8;
            val.get(propertyValueSint8);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueSint8.size(); i++)
            {
                propertyValueSint64.append((Sint64)propertyValueSint8[i]);
            }
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_SINT16:
        {
            Array<Sint16> propertyValueSint16;
            val.get(propertyValueSint16);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueSint16.size(); i++)
            {
                propertyValueSint64.append((Sint64)propertyValueSint16[i]);
            }
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_SINT32:
        {
            Array<Sint32> propertyValueSint32;
            val.get(propertyValueSint32);
            Array<Sint64> propertyValueSint64;
            for (Uint32 i = 0; i < propertyValueSint32.size(); i++)
            {
                propertyValueSint64.append(propertyValueSint32[i]);
            }
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_SINT64:
        {
            Array<Sint64> propertyValueSint64;
            val.get(propertyValueSint64);
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
        }
        break;

        case CIMTYPE_REAL32:
        {
            Array<Real32> propertyValueReal32;
            val.get(propertyValueReal32);
            Array<Real64> propertyValueReal64;
            for (Uint32 i = 0; i < propertyValueReal32.size(); i++)
            {
                propertyValueReal64.append((Real64)propertyValueReal32[i]);
            }
            value=FQLOperand(propertyValueReal64, FQL_DOUBLE_VALUE_TAG);
        }
        break;

        case CIMTYPE_REAL64:
        {
            Array<Real64> propertyValueReal64;
            val.get(propertyValueReal64);
            value=FQLOperand(propertyValueReal64, FQL_DOUBLE_VALUE_TAG);
        }
        break;

        case CIMTYPE_BOOLEAN :
        {
            Array<Boolean> booleanValues;
            val.get(booleanValues);
            value=FQLOperand(booleanValues, FQL_BOOLEAN_VALUE_TAG);
        }
        break;

        case CIMTYPE_CHAR16:
        {
            Array <Char16> char16val;
            val.get(char16val);
            String str;
            for (Uint32 i = 0 ; i < char16val.size(); i++)
            {
                str.append(char16val[i]);
            }
            value=FQLOperand(str, FQL_STRING_VALUE_TAG);
            break;
        }
        case CIMTYPE_DATETIME :
        {
            Array<CIMDateTime> datetimeValue;
            val.get(datetimeValue);
            value = FQLOperand(datetimeValue, FQL_DATETIME_VALUE_TAG);
            break;
        }
        case CIMTYPE_STRING :
        {
            Array<String> strValue;
            val.get(strValue);
            value=FQLOperand(strValue,FQL_STRING_VALUE_TAG);
            break;
        }
        case CIMTYPE_REFERENCE :
        {
            Array<CIMObjectPath> objPathValue;
            val.get(objPathValue);
            value=FQLOperand(objPathValue,FQL_REFERENCE_VALUE_TAG);
            break;
        }

        case CIMTYPE_OBJECT :
        case CIMTYPE_INSTANCE :
            PEGASUS_ASSERT(false);
        }
    }
    else
    {
        switch (type)
        {
        case CIMTYPE_UINT8:
            Uint8 propertyValueUint8;
            val.get(propertyValueUint8);
            value=FQLOperand(propertyValueUint8,FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_UINT16:
            Uint16 propertyValueUint16;
            val.get(propertyValueUint16);
            value=FQLOperand(propertyValueUint16, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_UINT32:
            Uint32 propertyValueUint32;
            val.get(propertyValueUint32);
            value=FQLOperand(propertyValueUint32, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_UINT64:
            Uint64 propertyValueUint64;
            val.get(propertyValueUint64);
            value=FQLOperand(propertyValueUint64, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_SINT8:
            Sint8 propertyValueSint8;
            val.get(propertyValueSint8);
            value=FQLOperand(propertyValueSint8, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_SINT16:
            Sint16 propertyValueSint16;
            val.get(propertyValueSint16);
            value=FQLOperand(propertyValueSint16, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_SINT32:
            Sint32 propertyValueSint32;
            val.get(propertyValueSint32);
            value=FQLOperand(propertyValueSint32, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_SINT64:
            Sint64 propertyValueSint64;
            val.get(propertyValueSint64);
            value=FQLOperand(propertyValueSint64, FQL_INTEGER_VALUE_TAG);
            break;

        case CIMTYPE_REAL32:
            Real32 propertyValueReal32;
            val.get(propertyValueReal32);
            value=FQLOperand(propertyValueReal32, FQL_DOUBLE_VALUE_TAG);
            break;

        case CIMTYPE_REAL64:
            Real64 propertyValueReal64;
            val.get(propertyValueReal64);
            value=FQLOperand(propertyValueReal64, FQL_DOUBLE_VALUE_TAG);
            break;

        case CIMTYPE_BOOLEAN :
            Boolean booleanValue;
            val.get(booleanValue);
            value=FQLOperand(booleanValue, FQL_BOOLEAN_VALUE_TAG);
            break;

        case CIMTYPE_CHAR16:
        {
            Char16 char16Value;
            val.get(char16Value);
            String str;
            str.append(char16Value);
            value=FQLOperand(str, FQL_STRING_VALUE_TAG);
            break;
        }
        case CIMTYPE_DATETIME :
        {
            CIMDateTime datetimeValue;
            val.get(datetimeValue);
            value=FQLOperand(datetimeValue, FQL_DATETIME_VALUE_TAG);
            break;
        }
        case CIMTYPE_STRING :
        {
            String strValue;
            val.get(strValue);
            value=FQLOperand(strValue,FQL_STRING_VALUE_TAG);
            break;
        }
        case CIMTYPE_REFERENCE :
        {
            CIMObjectPath objPathValue;
            val.get(objPathValue);
            value = FQLOperand(objPathValue, FQL_REFERENCE_VALUE_TAG);
            break;
        }
        // The following are not valid FQL types
        case CIMTYPE_OBJECT :
        case CIMTYPE_INSTANCE :
            PEGASUS_ASSERT(false);
        }
    }
    value.setCIMType(type);
    return true;
}
예제 #20
0
void test14 (CIMClient & client)
{
    CIMObjectPath instanceName;

    instanceName.setNameSpace (providerNamespace);
    instanceName.setClassName (CLASSNAME);

    Array < CIMParamValue > inParams;
    Array < CIMInstance> eObjs;
    Array < CIMParamValue > outParams;

    CIMValue retValue = client.invokeMethod (providerNamespace,
        instanceName,
        "returnInstance",
        inParams,
        outParams);

    PEGASUS_TEST_ASSERT (retValue.getType () == CIMTYPE_OBJECT);
    PEGASUS_TEST_ASSERT (!retValue.isArray ());
    PEGASUS_TEST_ASSERT (!retValue.isNull ());

    CIMObject result;
    retValue.get (result);
    CIMObjectPath objPath  = result.getPath();
    CIMInstance inputInstance(result);
    CIMInstance outputInstance;
    eObjs.append(inputInstance);
    eObjs.append(inputInstance);
    eObjs.append(inputInstance);

    inParams.append (
        CIMParamValue(String("inputInstances"), CIMValue(eObjs)));

    retValue = client.invokeMethod (providerNamespace,
        instanceName,
        "processArrayEmbeddedInstance",
        inParams,
        outParams);

    // First test the return value
    PEGASUS_TEST_ASSERT(retValue.getType() == CIMTYPE_INSTANCE);
    PEGASUS_TEST_ASSERT(!retValue.isArray());
    PEGASUS_TEST_ASSERT(!retValue.isNull());
    retValue.get(outputInstance);
    PEGASUS_TEST_ASSERT(objPath.toString() ==
        outputInstance.getPath().toString());
    PEGASUS_TEST_ASSERT(outputInstance.getPropertyCount() ==
        inputInstance.getPropertyCount());

    for(unsigned int i = 0, n = outputInstance.getPropertyCount(); i < n; ++i)
    {
        CIMProperty outputProp(outputInstance.getProperty(i));
        CIMProperty inputProp(inputInstance.getProperty(i));

        PEGASUS_TEST_ASSERT(outputProp.getName() == inputProp.getName());
        PEGASUS_TEST_ASSERT(outputProp.getValue() == inputProp.getValue());
    }

    // Now test the output parameters
    PEGASUS_TEST_ASSERT(outParams.size() == 3);
    CIMValue outParamValue = outParams[0].getValue();
    PEGASUS_TEST_ASSERT(outParamValue.isArray());
    PEGASUS_TEST_ASSERT(!outParamValue.isNull());

    Array<CIMInstance> instances;
    outParamValue.get(instances);

    for (unsigned int j = 0; j < instances.size () ; ++j)
    {
        outputInstance = instances[j];
        PEGASUS_TEST_ASSERT(objPath.toString() ==
            outputInstance.getPath().toString());
        PEGASUS_TEST_ASSERT(outputInstance.getPropertyCount() ==
            eObjs[j].getPropertyCount());
        for(unsigned int i = 0, n = outputInstance.getPropertyCount();
            i < n; ++i)
        {
            CIMProperty outputProp(outputInstance.getProperty(i));
            CIMProperty inputProp(eObjs[j].getProperty(i));
            PEGASUS_TEST_ASSERT(outputProp.getName() == inputProp.getName());
            PEGASUS_TEST_ASSERT(outputProp.getValue() == inputProp.getValue());
        }
    }

    outParamValue = outParams[1].getValue();
    PEGASUS_TEST_ASSERT(outParamValue.isArray());
    PEGASUS_TEST_ASSERT(!outParamValue.isNull());

    Array<CIMObject> objs;
    outParamValue.get(objs);

    for (unsigned int j = 0; j < objs.size () ; ++j)
    {
        outputInstance = CIMInstance(objs[j]);
        PEGASUS_TEST_ASSERT(objPath.toString() ==
            outputInstance.getPath().toString());
        PEGASUS_TEST_ASSERT(outputInstance.getPropertyCount() ==
            eObjs[j].getPropertyCount());
        for(unsigned int i = 0, n = outputInstance.getPropertyCount();
            i < n; ++i)
        {
            CIMProperty outputProp(outputInstance.getProperty(i));
            CIMProperty inputProp(eObjs[j].getProperty(i));
            PEGASUS_TEST_ASSERT(outputProp.getName() == inputProp.getName());
            PEGASUS_TEST_ASSERT(outputProp.getValue() == inputProp.getValue());
        }
    }

    outParamValue = outParams[2].getValue();
    PEGASUS_TEST_ASSERT(outParamValue.isArray());
    PEGASUS_TEST_ASSERT(!outParamValue.isNull());

    outParamValue.get(objs);

    for (Uint32 j = 0, m = objs.size(); j < m ; ++j)
    {
        outputInstance = CIMInstance(objs[j]);
        Uint32 id;
        CIMInstance emInstance;
        CIMObject emObject;
        outputInstance.getProperty(
            outputInstance.findProperty("id")).getValue().get(id);
        outputInstance.getProperty(
            outputInstance.findProperty("emInstance")).
                getValue().get(emInstance);
        outputInstance.getProperty(
            outputInstance.findProperty("emObject")).getValue().get(emObject);
        PEGASUS_TEST_ASSERT(eObjs[j].identical(emInstance));
        PEGASUS_TEST_ASSERT(eObjs[j].identical(CIMInstance(emObject)));
        PEGASUS_TEST_ASSERT(id == j+1);
    }

}
예제 #21
0
String IndicationFormatter::_getIndPropertyValue(
    const String & specifiedPropertyName,
    const String & arrayIndexStr,
    const CIMInstance & indication,
    const ContentLanguages & contentLangs)
{
    PEG_METHOD_ENTER (TRC_IND_FORMATTER,
        "IndicationFormatter::_getIndPropertyValue");

    CIMInstance indicationInstance = indication.clone();
    String propertyName;

    Boolean canLocalize = false;

#if defined(PEGASUS_HAS_ICU) && defined(PEGASUS_INDFORMATTER_USE_ICU)
    Locale locale;
    canLocalize = _canLocalize(contentLangs, locale);
#endif

    for (Uint32 i=0; i < indicationInstance.getPropertyCount(); i++)
    {
        CIMProperty property = indicationInstance.getProperty(i);
        propertyName = property.getName().getString();

        // get specified property value
        if (String::equalNoCase(propertyName, specifiedPropertyName))
        {
            CIMValue propertyValue = property.getValue();
            Boolean valueIsNull = propertyValue.isNull();
	    CIMType type = propertyValue.getType();

            if (!valueIsNull)
            {
                Boolean isArray = propertyValue.isArray();

                if (isArray)
                {
                    PEG_METHOD_EXIT();
		    return (_getArrayValues(propertyValue, arrayIndexStr,
			                    contentLangs));
                }
                else // value is not an array
                {
#if defined(PEGASUS_HAS_ICU) && defined(PEGASUS_INDFORMATTER_USE_ICU)
		    if (canLocalize)
		    {
                        if (type == CIMTYPE_DATETIME)
		        {
			    CIMDateTime dateTimeValue;
			    propertyValue.get(dateTimeValue);
                            PEG_METHOD_EXIT();
			    return(_localizeDateTime(dateTimeValue, locale));
		        }
                        else if (type == CIMTYPE_BOOLEAN)
		        {
			    Boolean booleanValue;
			    propertyValue.get(booleanValue);
                            PEG_METHOD_EXIT();
			    return(_localizeBooleanStr(booleanValue, locale));
		        }
                        else
                        {
                            PEG_METHOD_EXIT();
                            return (propertyValue.toString());
                        }
		    }
		    else
		    {
			if (type == CIMTYPE_BOOLEAN)
			{
                            PEG_METHOD_EXIT();
                            return (_getBooleanStr(propertyValue));
			}
			else
			{
                            PEG_METHOD_EXIT();
                            return (propertyValue.toString());
			}
		    }
#else
		    if (type == CIMTYPE_BOOLEAN)
		    {
                        PEG_METHOD_EXIT();
                        return (_getBooleanStr(propertyValue));
		    }
		    else
		    {
                        PEG_METHOD_EXIT();
                        return (propertyValue.toString());
		    }
#endif
                }

            }
            else // value is NULL
            {
                PEG_METHOD_EXIT();
                return ("NULL");
            }

        }
        propertyName.clear();
    }

    PEG_METHOD_EXIT();

    return ("UNKNOWN");
}
예제 #22
0
void test01()
{
    CIMProperty pnull;

    PEGASUS_TEST_ASSERT(pnull.isUninitialized());

    CIMProperty p1(CIMName ("message"), String("Hi There"));
    p1.addQualifier(CIMQualifier(CIMName ("Key"), true));
    p1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
    p1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
    p1.addQualifier(CIMQualifier(CIMName ("Description"), String("Blah Blah")));
    CIMConstProperty p2 = p1;

    // Test clone
    CIMProperty p1clone = p1.clone();
    CIMProperty p2clone = p2.clone();
   
    // Test print

    if(verbose)
    {
       XmlWriter::printPropertyElement(p1, cout);
       XmlWriter::printPropertyElement(p2, cout);
       XmlWriter::printPropertyElement(p1clone, cout);
       XmlWriter::printPropertyElement(p2clone, cout);
    }

    // Test toMof
       Buffer mofOut;
       MofWriter::appendPropertyElement(true, mofOut, p1);
       MofWriter::appendPropertyElement(true, mofOut, p2);

    // Test toXml
       Buffer xmlOut;
       XmlWriter::appendPropertyElement(xmlOut, p1);
       XmlWriter::appendPropertyElement(xmlOut, p2);

    // Test name
        CIMName name;
        name = p1.getName();
        PEGASUS_TEST_ASSERT(name == CIMName ("message"));
        name = p2.getName();
        PEGASUS_TEST_ASSERT(name == CIMName ("message"));

    // Test type
        PEGASUS_TEST_ASSERT(p1.getType() == CIMTYPE_STRING);
        PEGASUS_TEST_ASSERT(p2.getType() == CIMTYPE_STRING);

    // Test for key qualifier
        Uint32 pos;
        Boolean isKey = false;
        if ((pos = p1.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)
        {
            CIMValue value;
            value = p1.getQualifier (pos).getValue ();
            if (!value.isNull ())
            {
                value.get (isKey);
            }
        }
        PEGASUS_TEST_ASSERT (isKey);
        isKey = false;
        if ((pos = p2.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)
        {
            CIMValue value;
            value = p2.getQualifier (pos).getValue ();
            if (!value.isNull ())
            {
                value.get (isKey);
            }
        }
        PEGASUS_TEST_ASSERT (isKey);
    // Test for key property using CIMPropertyInternal
        PEGASUS_TEST_ASSERT (CIMPropertyInternal::isKeyProperty(p1));
        PEGASUS_TEST_ASSERT (CIMPropertyInternal::isKeyProperty(p2));

    // Test getArraySize
        PEGASUS_TEST_ASSERT(p1.getArraySize() == 0);
        PEGASUS_TEST_ASSERT(p2.getArraySize() == 0);

    // Test getPropagated
        PEGASUS_TEST_ASSERT(p1.getPropagated() == false);
        PEGASUS_TEST_ASSERT(p2.getPropagated() == false);

    // Tests for Qualifiers
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff21")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuf")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.getQualifierCount() == 4);

    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuff21")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuf")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.getQualifierCount() == 4);

    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);

    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff21")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuf")) == PEG_NOT_FOUND);

    Uint32 posQualifier;
    posQualifier = p1.findQualifier(CIMName ("stuff"));
    PEGASUS_TEST_ASSERT(posQualifier != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(posQualifier < p1.getQualifierCount());

    p1.removeQualifier(posQualifier);
    PEGASUS_TEST_ASSERT(p1.getQualifierCount() == 3);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);

    // Tests for value insertion.
    {
        CIMProperty px(CIMName ("p1"), String("Hi There"));
        // test for CIMValue and type
        CIMProperty py(CIMName ("p2"), Uint32(999));
        // test for CIMValue and type

        //Test getName and setName
        PEGASUS_TEST_ASSERT(px.getName() == CIMName ("p1"));
        px.setName(CIMName ("px"));
        PEGASUS_TEST_ASSERT(px.getName() == CIMName ("px"));

        PEGASUS_TEST_ASSERT(py.getName() == CIMName ("p2"));
        py.setName(CIMName ("py"));
        PEGASUS_TEST_ASSERT(py.getName() == CIMName ("py"));

        // ATTN: Test setValue and getValue
    }
}
예제 #23
0
/**
 * This tests the embedded instance functionality through the CMPI Test
 * Method Provider. It first invokes the returnInstance() method to retrieve
 * an instance that can be used 
 */
void test09 (CIMClient & client)
{
  CIMObjectPath instanceName;

  instanceName.setNameSpace (providerNamespace);
  instanceName.setClassName (CLASSNAME);

  Array < CIMParamValue > inParams;
  Array < CIMParamValue > outParams;

  /*     [EmbeddedObject] String returnInstance(); */

  CIMValue retValue = client.invokeMethod (providerNamespace,
                       instanceName,
                       "returnInstance",
                       inParams,
                       outParams);

  PEGASUS_TEST_ASSERT (retValue.getType () == CIMTYPE_OBJECT);
  PEGASUS_TEST_ASSERT (!retValue.isArray ());
  PEGASUS_TEST_ASSERT (!retValue.isNull ());

  CIMObject result;
  retValue.get (result);

  CIMObjectPath objPath  = result.getPath();

  CIMInstance inputInstance(result);
  CIMInstance outputInstance;

  inParams.append(
      CIMParamValue(String("inputInstance"), CIMValue(inputInstance)));

  retValue = client.invokeMethod (providerNamespace,
      instanceName,
      "processEmbeddedInstance",
      inParams,
      outParams);

  // First test the return value
  PEGASUS_TEST_ASSERT(retValue.getType() == CIMTYPE_INSTANCE);
  PEGASUS_TEST_ASSERT(!retValue.isArray());
  PEGASUS_TEST_ASSERT(!retValue.isNull());
  retValue.get(outputInstance);
  PEGASUS_TEST_ASSERT(objPath.toString() ==
    outputInstance.getPath().toString());
  PEGASUS_TEST_ASSERT(outputInstance.getPropertyCount() ==
    inputInstance.getPropertyCount());
  for(unsigned int i = 0, n = outputInstance.getPropertyCount(); i < n; ++i)
  {
    CIMProperty outputProp(outputInstance.getProperty(i));
    CIMProperty inputProp(inputInstance.getProperty(i));

    PEGASUS_TEST_ASSERT(outputProp.getName() == inputProp.getName());
    PEGASUS_TEST_ASSERT(outputProp.getValue() == inputProp.getValue());
  }

  // Now test the output parameter
  PEGASUS_TEST_ASSERT(outParams.size() == 1);
  retValue = outParams[0].getValue();

  PEGASUS_TEST_ASSERT(retValue.getType() == CIMTYPE_INSTANCE);
  PEGASUS_TEST_ASSERT(!retValue.isArray());
  PEGASUS_TEST_ASSERT(!retValue.isNull());
  retValue.get(outputInstance);
  PEGASUS_TEST_ASSERT(objPath.toString() ==
    outputInstance.getPath().toString());
  PEGASUS_TEST_ASSERT(outputInstance.getPropertyCount() ==
    inputInstance.getPropertyCount());
  for(unsigned int i = 0, n = outputInstance.getPropertyCount(); i < n; ++i)
  {
    CIMProperty outputProp(outputInstance.getProperty(i));
    CIMProperty inputProp(inputInstance.getProperty(i));

    PEGASUS_TEST_ASSERT(outputProp.getName() == inputProp.getName());
    PEGASUS_TEST_ASSERT(outputProp.getValue() == inputProp.getValue());
  }
}
예제 #24
0
void AuditLogger::logCurrentRegProvider(
    const Array < CIMInstance > & instances)
{
    // check if SMF is gathering this type of records.
    if (_smf.isRecording(CONFIGURATION) ||
        (! _isInternalWriterUsed) )
    {
        unsigned char * provStatRecord;
        unsigned char * cursor;
        int cursorOffset;

        _smf86_provider_status * provStatSection;

        String moduleName;
        int moduleNameLen;
        String statusValue;
        Uint32 pos;

        // For all current registered providers.
        for (Uint32 i = 0; i < instances.size(); i++)
        {
            // Get the module name.
            instances[i].getProperty(instances[i].findProperty(
                _PROPERTY_PROVIDERMODULE_NAME)).getValue().get(moduleName);

            // +1 for the 0x00 termination.
            moduleNameLen = moduleName.size()+1;

            // Allocate the full record.
            provStatRecord = (unsigned char *) calloc(1,
                sizeof(_smf86_provider_status_record) + moduleNameLen );

            // Initialize the header and product section.
            // The length is the total of subtype section + variable parts.
            _smf.initMyProlog((_smf86_record_prolog *)provStatRecord,
                PROVIDER_STATUS,
                sizeof(_smf86_provider_status) + moduleNameLen );

            // Set the pointer to the subtype section.
            provStatSection = (_smf86_provider_status *)
                (provStatRecord + sizeof(_smf86_record_prolog));

            pos = instances[i].findProperty(_PROPERTY_OPERATIONALSTATUS);

            if (pos == PEG_NOT_FOUND)
            {
                provStatSection->CurrStatus = 0;
            }
            else
            {
                CIMValue theValue = instances[i].getProperty(pos).getValue();
                if (theValue.isNull())
                {
                    provStatSection->CurrStatus = 0;
                }
                else
                {
                    Array<Uint16> moduleStatus;
                    // Get the module status
                    theValue.get(moduleStatus);
                    // reset the smf record field
                    provStatSection->CurrStatus = 0;
                    for (int j = 0; j < moduleStatus.size();j++)
                    {
                        // Accumulate the status of the provider
                        // by shifting a bit the value of moduleStatus
                        // times to the left to get the right bit set.
                        provStatSection->CurrStatus =
                            provStatSection->CurrStatus +
                            ( 1 << moduleStatus[j] );
                    }

                }
            } // End of status set.

            // The provider does not change its state.
            provStatSection->IsChanging=0;
            provStatSection->NewStatus=0;

            // The variable values are starting
            // at the end of the subtype section.
            cursor = provStatRecord + sizeof(_smf86_provider_status_record);
            cursorOffset = sizeof(_smf86_provider_status);

            // Set the provider module name.
            provStatSection->ProvNameOf = cursorOffset;
            provStatSection->ProvNameNo = 1;
            provStatSection->ProvNameLen = moduleNameLen;
            _smf.setEBCDICRecordField(cursor,
                (const char*)moduleName.getCString(),
                moduleNameLen,true);

            _writeAuditMessage(PROVIDER_STATUS,(char *)provStatRecord);
            free(provStatRecord);

        } // For all current registered providers.
    }
}
예제 #25
0
void
test03 (CIMClient & client)
{
  CIMObjectPath instanceName;

  instanceName.setNameSpace (providerNamespace);
  instanceName.setClassName (CLASSNAME);

  Array < CIMParamValue > inParams;
  Array < CIMParamValue > outParams;

  /*     uint32 TestCMPIBroker (
   *          [IN, Description (
   *          "The requested are to test different 
   *          CMPI data structure operations."),
   *          ValueMap { "1", "2", "3", "4", "5", "6"},
   *          Values {"CDGetType", "CDToString", "CDIsOfType",
   *                  "CMGetMessage",  "CMLogMessage","CDTraceMessage"}]
   *          uint32 Operation,
   *          [OUT, Description (
   *          " The result of what the operation carried out.")]
   *          string Result);
   *
   */
  {
    /* CDGetType */
    inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (1))));
    CIMValue retValue = client.invokeMethod (providerNamespace,
                         instanceName,
                         "TestCMPIBroker",
                         inParams,
                         outParams);
    // Check the return value. Make sure it is 0.
    _checkUint32Value (retValue, 0);

    PEGASUS_TEST_ASSERT (outParams.size () == 1);
    CIMValue paramValue = outParams[0].getValue ();
    _checkStringValue (paramValue, "CMPIArgs");
  }
  inParams.clear ();
  outParams.clear ();
  {
    /* CDToString */
    inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (2))));
    CIMValue retValue = client.invokeMethod (providerNamespace,
                         instanceName,
                         "TestCMPIBroker",
                         inParams,
                         outParams);
    // Check the return value. Make sure it is 0.
    _checkUint32Value (retValue, 0);

    PEGASUS_TEST_ASSERT (outParams.size () == 1);
    CIMValue paramValue = outParams[0].getValue ();
    _checkStringValue (paramValue, " Operation:2\n");
  }
  inParams.clear ();
  outParams.clear ();
  {
    /* CDIsOfType */
    inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (3))));
    CIMValue retValue = client.invokeMethod (providerNamespace,
                         instanceName,
                         "TestCMPIBroker",
                         inParams,
                         outParams);
    // Check the return value. Make sure it is 0.
    _checkUint32Value (retValue, 0);

    PEGASUS_TEST_ASSERT (outParams.size () == 1);
    CIMValue paramValue = outParams[0].getValue ();
    _checkStringValue (paramValue, "++++ CMPIArgs = Yes");
  }
  inParams.clear ();
  outParams.clear ();
  {
    /* CMGetMessage */
    inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (4))));
    CIMValue retValue = client.invokeMethod (providerNamespace,
                         instanceName,
                         "TestCMPIBroker",
                         inParams,
                         outParams);
    // Check the return value. Make sure it is 0.
    _checkUint32Value (retValue, 0);

    PEGASUS_TEST_ASSERT (outParams.size () == 1);
    CIMValue paramValue = outParams[0].getValue ();
    // If PEGASUS_USE_DEFAULT_MESSAGES is not set, we can't make an
    // assumption about what the value of the msg will be.
    if (useDefaultMsg)
    {
        _checkStringValue (paramValue, "CIM_ERR_SUCCESS: Successful.");
    }
  }
  inParams.clear ();
  outParams.clear ();
  {
    /* CMLogMessage */
    inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (5))));
    CIMValue retValue = client.invokeMethod (providerNamespace,
                         instanceName,
                         "TestCMPIBroker",
                         inParams,
                         outParams);
    // Check the return value. Make sure it is 0.
    _checkUint32Value (retValue, 0);
    // Nothing is returned
    PEGASUS_TEST_ASSERT (outParams.size () == 1);

    CIMValue paramValue = outParams[0].getValue ();
    PEGASUS_TEST_ASSERT (paramValue.isNull ());

  }
  inParams.clear ();
  outParams.clear ();
  {
    /* CMTraceMessage */
    inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (6))));
    CIMValue retValue = client.invokeMethod (providerNamespace,
                         instanceName,
                         "TestCMPIBroker",
                         inParams,
                         outParams);
    // Check the return value. Make sure it is 0.
    _checkUint32Value (retValue, 0);
    // Nothing is returned
    PEGASUS_TEST_ASSERT (outParams.size () == 1);

    CIMValue paramValue = outParams[0].getValue ();
    PEGASUS_TEST_ASSERT (paramValue.isNull ());

  }
  inParams.clear ();
  outParams.clear ();
  {
//       CMGetMessage2 
      inParams.append(CIMParamValue(
                          "Operation",
                          CIMValue(Uint32(7))));
      inParams.append(CIMParamValue(
                          "msgFile",
                          CIMValue(String("test/pegasusTest"))));
      inParams.append(CIMParamValue(
                          "msgId",
                          CIMValue(String("CIMStatusCode.CIM_ERR_SUCCESS"))));
      inParams.append(CIMParamValue(
                          "insert1",
                          CIMValue(String("rab oof is foo bar backwards"))));
      inParams.append(CIMParamValue(
                          "insert2",
                          CIMValue(Uint32(64001))));

      AcceptLanguageList accLangs;
      accLangs.insert(LanguageTag("en-US"),Real32(1.0));
      accLangs.insert(LanguageTag("fr"),Real32(0.8));
      client.setRequestAcceptLanguages(accLangs);

      CIMValue retValue = client.invokeMethod (providerNamespace,
          instanceName,
          "TestCMPIBroker",
          inParams,
          outParams);
      // Check the return value. Make sure it is 0.
      _checkUint32Value (retValue, 0);

      PEGASUS_TEST_ASSERT (outParams.size () == 1);
      CIMValue paramValue = outParams[0].getValue ();
      // If PEGASUS_USE_DEFAULT_MESSAGES is not set, we can't make an
      // assumption about what the value of the msg will be, or the
      // ContentLanguage.
#ifdef PEGASUS_HAS_MESSAGES
      if (useDefaultMsg)
      {
#endif
          _checkStringValue (paramValue, "CIM_ERR_SUCCESS: Successful.");
#ifdef PEGASUS_HAS_MESSAGES
      }
      else
      {
          ContentLanguageList contLangs;
          contLangs = client.getResponseContentLanguages();
          cout << "ContentLanguage size == " << contLangs.size() << endl;
          PEGASUS_TEST_ASSERT(contLangs.size() == 1);
          cout << "ContentLanguage == "
               << contLangs.getLanguageTag(0).toString();
          PEGASUS_TEST_ASSERT(
              contLangs.getLanguageTag(0).toString() == "en-US");
      }
#endif
      // Reset client
      accLangs.clear();
      client.setRequestAcceptLanguages(accLangs);
  }


    inParams.clear();
    outParams.clear();
    {
        // _testCMPIEnumeration
        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (8))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);

        PEGASUS_TEST_ASSERT (outParams.size () == 1);
        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    
    inParams.clear();
    outParams.clear();
    {
        // _testCMPIArray
        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (9))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);

        PEGASUS_TEST_ASSERT (outParams.size () == 1);
        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
        // _testCMPIcontext

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (10))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                             instanceName,
                             "TestCMPIBroker",
                             inParams,
                             outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);

        PEGASUS_TEST_ASSERT (outParams.size () == 1);
        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
        // _testCMPIDateTime

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (11))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);

        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
      //   _testCMPIInstance

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (12))));

        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);
        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
    //     _testCMPIObjectPath

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (13))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);

        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
        //  _testCMPIResult

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (14))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);

        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
        //  _testCMPIString

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (15))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        // Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);

        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

    inParams.clear();
    outParams.clear();
    {
        //_testCMPIArgs

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (16))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        //Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);

        CIMValue paramValue = outParams[0].getValue ();
        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }
    inParams.clear();
    outParams.clear();
    {
         //_testCMPIBroker

        inParams.append (CIMParamValue ("Operation", CIMValue (Uint32 (17))));
        CIMValue retValue = client.invokeMethod (providerNamespace,
                                                 instanceName,
                                                 "TestCMPIBroker",
                                                 inParams,
                                                 outParams);
        //Check the return value. Make sure it is 0.
        _checkUint32Value (retValue, 0);
        // Nothing is returned
        PEGASUS_TEST_ASSERT (outParams.size () == 1);

        CIMValue paramValue = outParams[0].getValue ();

        PEGASUS_TEST_ASSERT (paramValue.isNull ());
    }

}
예제 #26
0
String IndicationFormatter::getFormattedIndText(
    const CIMInstance & subscription,
    const CIMInstance & indication,
    const ContentLanguages & contentLangs)
{
    PEG_METHOD_ENTER (TRC_IND_FORMATTER,
        "IndicationFormatter::getFormattedIndText");

    String indicationText;
    String textFormat = String::EMPTY;
    CIMValue textFormatValue;
    CIMValue textFormatParamsValue;

    Array<String> textFormatParams;

        // get TextFormat from subscription
        Uint32 textFormatPos =
	    subscription.findProperty(_PROPERTY_TEXTFORMAT);

	// if the property TextFormat is not found,
	// indication is constructed with default format
        if (textFormatPos == PEG_NOT_FOUND)
        {
            indicationText = _formatDefaultIndicationText(indication,
							 contentLangs);
        }
        else
        {
            textFormatValue = subscription.getProperty(textFormatPos).
		getValue();

	    // if the value of textFormat is NULL,
	    // indication is constructed with default format
            if (textFormatValue.isNull())
            {
                indicationText = _formatDefaultIndicationText(indication,
							     contentLangs);
	    }
	    else
	    {
                // get TextFormatParameters from subscription
                Uint32 textFormatParamsPos = subscription.findProperty(
		    _PROPERTY_TEXTFORMATPARAMETERS);

	        if (textFormatParamsPos != PEG_NOT_FOUND)
	        {
                    textFormatParamsValue = subscription.getProperty(
	                textFormatParamsPos).getValue();
                }

		// constructs indication with specified format
		if ((textFormatValue.getType() == CIMTYPE_STRING) &&
		    !(textFormatValue.isArray()))
                {
		    textFormatValue.get(textFormat);
		    if (!textFormatParamsValue.isNull())
		    {
			if ((textFormatParamsValue.getType() ==
			     CIMTYPE_STRING) &&
                            (textFormatParamsValue.isArray()))
                        {
		            textFormatParamsValue.get(textFormatParams);
                        }
		    }

		    indicationText = _formatIndicationText(textFormat,
				                          textFormatParams,
				                          indication,
				                          contentLangs);
		}
		else
		{
                    indicationText = _formatDefaultIndicationText(indication,
				                                 contentLangs);
		}
	    }

        }

        PEG_METHOD_EXIT();
	return (indicationText);
}
void SystemLogListenerDestination::handleIndication(
    const OperationContext& context,
    const String nameSpace,
    CIMInstance& indication,
    CIMInstance& handler,
    CIMInstance& subscription,
    ContentLanguageList& contentLanguages)
{
    PEG_METHOD_ENTER(TRC_IND_HANDLER,
        "SystemLogListenerDestination::handleIndication");

    String ident_name = "CIM Indication";
    String indicationText;

    try
    {
        PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
            "SystemLogListenerDestination %s:%s.%s processing %s Indication",
           (const char*)(nameSpace.getCString()),
           (const char*)(handler.getClassName().getString().getCString()),
           (const char*)(handler.getProperty(
           handler.findProperty(PEGASUS_PROPERTYNAME_NAME)).
           getValue().toString().getCString()),
           (const char*)(indication.getClassName().getString().
           getCString())));
        // gets formatted indication message
        indicationText = IndicationFormatter::getFormattedIndText(
            subscription, indication, contentLanguages);

        // default severity
        Uint32 severity = Logger::INFORMATION;

        // If an indication contains severity information, gets the value
        // and maps it to Pegasus logger severity. Otherwise, default value
        // is used.

        Uint32 severityPos =
            indication.findProperty(CIMName("PerceivedSeverity"));

        if (severityPos != PEG_NOT_FOUND)
        {
            Uint16 perceivedSeverity;
            CIMValue perceivedSeverityValue =
                indication.getProperty(severityPos).getValue();

            if (!perceivedSeverityValue.isNull())
            {
                perceivedSeverityValue.get(perceivedSeverity);

                switch (perceivedSeverity)
                {
                    case (_SEVERITY_FATAL):
                    case (_SEVERITY_CRITICAL):
                    {
                        severity = Logger::FATAL;
                        break;
                    }

                    case (_SEVERITY_MAJOR):
                    {
                        severity = Logger::SEVERE;
                        break;
                    }

                    case (_SEVERITY_MINOR):
                    case (_SEVERITY_WARNING):
                    {
                        severity = Logger::WARNING;
                        break;
                    }

                    case (_SEVERITY_INFORMATION):
                    case (_SEVERITY_OTHER):
                    case (_SEVERITY_UNKNOWN):
                    {
                        severity = Logger::INFORMATION;
                        break;
                    }

                    default:
                    {
                        PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL2,
                            "PerceivedSeverity = %d is not a valid value."
                            " Using default severity.", perceivedSeverity));
                        break;
                    }
                }
            }
        }

       PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
           "SystemLogListenerDestination writing %s Indication to system log",
           (const char*)(indication.getClassName().getString().getCString())));
       // writes the formatted indication to a system log file
        _writeToSystemLog(ident_name, severity, indicationText);
       PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
           "%s Indication written to system log successfully",
           (const char*)(indication.getClassName().getString().getCString())));
    }
    catch (CIMException& c)
    {
        PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL1, "CIMException: %s",
            (const char*)c.getMessage().getCString()));
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, c.getMessage());
    }
    catch (Exception&e)
    {
        PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL1, "Exception: %s",
            (const char*)e.getMessage().getCString()));
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
    }
    catch (...)
    {
        PEG_TRACE_CSTRING(TRC_IND_HANDLER, Tracer::LEVEL1,
            "Failed to deliver indication to system log file.");
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
            "Handler.SystemLogListenerDestination.SystemLogListenerDestination."
                "FAILED_TO_DELIVER_INDICATION_TO_SYSTEM_LOG",
            "Failed to deliver indication to system log file."));
    }

    PEG_METHOD_EXIT();
}
예제 #28
0
String IndicationFormatter::_formatDefaultIndicationText(
    const CIMInstance & indication,
    const ContentLanguages & contentLangs)
{
    PEG_METHOD_ENTER (TRC_IND_FORMATTER,
        "IndicationFormatter::_formatDefaultIndicationText");

    CIMInstance indicationInstance = indication.clone();
    String propertyName;
    String indicationStr;
    Uint32 propertyCount = indicationInstance.getPropertyCount();

    indicationStr.append("Indication (default format):");

    Boolean canLocalize = false;

#if defined(PEGASUS_HAS_ICU) && defined(PEGASUS_INDFORMATTER_USE_ICU)
    Locale locale;
    canLocalize = _canLocalize(contentLangs, locale);
#endif

    for (Uint32 i=0; i < propertyCount; i++)
    {
        CIMProperty property = indicationInstance.getProperty(i);
        propertyName = property.getName().getString();
        CIMValue propertyValue = property.getValue();
        Boolean valueIsNull = propertyValue.isNull();
        Boolean isArray = propertyValue.isArray();

        indicationStr.append(propertyName);
        indicationStr.append(" = ");

	CIMType type = propertyValue.getType();

        if (!valueIsNull)
        {
            if (isArray)
            {
		indicationStr.append(_getArrayValues(propertyValue, "",
		    contentLangs));
            }
            else // value is not an array
            {
#if defined(PEGASUS_HAS_ICU) && defined(PEGASUS_INDFORMATTER_USE_ICU)
		if (canLocalize)
		{
		    if (type == CIMTYPE_DATETIME)
		    {
			CIMDateTime dateTimeValue;
			propertyValue.get(dateTimeValue);
		        indicationStr.append(_localizeDateTime(dateTimeValue,
		    	    locale));
		    }
		    else if (type == CIMTYPE_BOOLEAN)
		    {
			Boolean booleanValue;
			propertyValue.get(booleanValue);
		        indicationStr.append(_localizeBooleanStr(booleanValue,
		    	    locale));
		    }
		    else
		    {
			indicationStr.append(propertyValue.toString());
		    }
		}
		else
		{
		    if (type == CIMTYPE_BOOLEAN)
		    {
                        indicationStr.append(_getBooleanStr(propertyValue));
		    }
		    else
		    {
                        indicationStr.append(propertyValue.toString());
		    }
		}
#else
		if (type == CIMTYPE_BOOLEAN)
		{
                    indicationStr.append(_getBooleanStr(propertyValue));
		}
		else
		{
                    indicationStr.append(propertyValue.toString());
		}
#endif
            }
        }
	else
	{
	    indicationStr.append("NULL");
	}

        if (i < propertyCount -1)
        {
            indicationStr.append(", ");
        }

        propertyName.clear();
    }

    PEG_METHOD_EXIT();

    return (indicationStr);
}
예제 #29
0
void test02()
{
    // Tests for CIMConstProperty methods
        CIMProperty p1(CIMName ("message"), String("Hi There"));
        p1.addQualifier(CIMQualifier(CIMName ("Key"), true));
        p1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
        p1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
        p1.addQualifier(CIMQualifier(CIMName ("Description"),
                                     String("Blah Blah")));
        CIMConstProperty p2 = p1;

        CIMConstProperty cp1 = p1;
        CIMConstProperty cp2 = p2;
        CIMConstProperty cp3(CIMName ("message3"), String("hello"));
        CIMConstProperty cp1clone = cp1.clone();

        if(verbose)
        XmlWriter::printPropertyElement(cp1, cout);

        Buffer mofOut;
        MofWriter::appendPropertyElement(true,mofOut, cp1);
        Buffer xmlOut;
        XmlWriter::appendPropertyElement(xmlOut, cp1);

        PEGASUS_TEST_ASSERT(cp1.getName() == CIMName ("message"));
        PEGASUS_TEST_ASSERT(cp1.getType() == CIMTYPE_STRING);
        Uint32 pos;
        Boolean isKey = false;
        if ((pos = cp1.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)
        {
            CIMValue value;
            value = cp1.getQualifier (pos).getValue ();
            if (!value.isNull ())
            {
                value.get (isKey);
            }
        }
        PEGASUS_TEST_ASSERT (isKey);
        PEGASUS_TEST_ASSERT(cp1.getArraySize() == 0);
        PEGASUS_TEST_ASSERT(cp1.getPropagated() == false);

    PEGASUS_TEST_ASSERT(cp1.findQualifier(
        CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(cp1.findQualifier(
        CIMName ("stuff2")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(cp1.findQualifier(
        CIMName ("stuff21")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(cp1.findQualifier(
        CIMName ("stuf")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(cp1.getQualifierCount() == 4);
 
        try 
        {
            p1.getQualifier(0);
        }
        catch(IndexOutOfBoundsException& e)
        {
            if(verbose)
                cout << "Exception: " << e.getMessage() << endl;    
        }
}