Exemple #1
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);
}
Exemple #2
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");

}
Exemple #3
0
    static CMPIData mbGetProperty(
        const CMPIBroker *mb,
        const CMPIContext *ctx,
        const CMPIObjectPath *cop,
        const char *name,
        CMPIStatus *rc)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Broker:mbGetProperty()");
        mb = CM_BROKER;
        CMPIData data = {0,CMPI_nullValue,{0}};

        SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
        CIMObjectPath qop;
        scmoObjPath->getCIMObjectPath(qop);

        try
        {
            CIMValue v = CM_CIMOM(mb)->getProperty(
                *CM_Context(ctx),
                SCMO_ObjectPath(cop)->getNameSpace(),
                qop,
                String(name));
            CIMType vType = v.getType();
            CMPIType t = type2CMPIType(vType,v.isArray());
            value2CMPIData(v,t,&data);
            CMSetStatus(rc,CMPI_RC_OK);
        }
        HandlerCatchSetStatus(rc, data);

        PEG_METHOD_EXIT();
        return data; // "data" will be valid data or nullValue (in error case)
    }
Exemple #4
0
void _checkUint32Property
  (CIMInstance & instance, const String & name, Uint32 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_UINT32);
  PEGASUS_ASSERT (!theValue.isArray ());
  PEGASUS_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_ASSERT (result == value);
}
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);
    }
}
CIMPropertyRep::CIMPropertyRep(
    const CIMName& name,
    const CIMValue& value,
    Uint32 arraySize,
    const CIMName& referenceClassName,
    const CIMName& classOrigin,
    Boolean propagated)
    :
    _name(name), _value(value), _arraySize(arraySize),
    _referenceClassName(referenceClassName), _classOrigin(classOrigin),
    _propagated(propagated), _refCounter(1), _ownerCount(0)
{
    // ensure name is not null
    if (name.isNull())
    {
        throw UninitializedObjectException();
    }

    // Set the CIM name tag.
    _nameTag = generateCIMNameTag(_name);

    if ((arraySize != 0) &&
        (!value.isArray() || value.getArraySize() != arraySize))
    {
        throw TypeMismatchException();
    }

    // A CIM Property may not be of reference array type
    if (value.isArray() && (value.getType() == CIMTYPE_REFERENCE))
    {
        throw TypeMismatchException();
    }

    // if referenceClassName exists, must be CIMType REFERENCE.
    if (!referenceClassName.isNull())
    {
        if (_value.getType() != CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }

    // Can a property be of reference type with a null referenceClassName?
    // The DMTF says yes if it is a property of an instance; no if it is a
    // property of a class.  We'll allow it here, but check in the CIMClass
    // addProperty() method.
}
Exemple #7
0
Boolean CIMKeyBinding::equal(CIMValue value)
{
    if (value.isArray())
    {
        return false;
    }

    CIMValue kbValue;

    try
    {
        switch (value.getType())
        {
        case CIMTYPE_CHAR16:
            if (getType() != STRING) return false;
            kbValue.set(getValue()[0]);
            break;
        case CIMTYPE_DATETIME:
            if (getType() != STRING) return false;
            kbValue.set(CIMDateTime(getValue()));
            break;
        case CIMTYPE_STRING:
            if (getType() != STRING) return false;
            kbValue.set(getValue());
            break;
        case CIMTYPE_REFERENCE:
            if (getType() != REFERENCE) return false;
            kbValue.set(CIMObjectPath(getValue()));
            break;
        case CIMTYPE_BOOLEAN:
            if (getType() != BOOLEAN) return false;
            kbValue = XmlReader::stringToValue(0, getValue().getCString(),
                                               value.getType());
            break;
//      case CIMTYPE_REAL32:
//      case CIMTYPE_REAL64:
        case CIMTYPE_OBJECT:
        case CIMTYPE_INSTANCE:
            // From PEP 194: EmbeddedObjects cannot be keys.
            return false;
        default:  // Numerics
            if (getType() != NUMERIC) return false;
            kbValue = XmlReader::stringToValue(0, getValue().getCString(),
                                               value.getType());
            break;
        }
    }
    catch (Exception&)
    {
        return false;
    }

    return value.equal(kbValue);
}
void CIMPropertyRep::setValue(const CIMValue& value)
{
    // CIMType of value is immutable:

    if (!value.typeCompatible(_value))
        throw TypeMismatchException();

    if (_arraySize && _arraySize != value.getArraySize())
        throw TypeMismatchException();

    // A CIM Property may not be of reference array type
    if (value.isArray() && (value.getType() == CIMTYPE_REFERENCE))
    {
        throw TypeMismatchException();
    }

    _value = value;
}
Exemple #9
0
    static CMPIData mbInvokeMethod(
        const CMPIBroker *mb,
        const CMPIContext *ctx,
        const CMPIObjectPath *cop,
        const char *method,
        const CMPIArgs *in,
        CMPIArgs *out,
        CMPIStatus *rc)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Broker:mbInvokeMethod()");
        CMPIData data = {0,CMPI_nullValue,{0}};
        mb = CM_BROKER;


        SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
        CIMObjectPath qop;
        try
        {
            scmoObjPath->getCIMObjectPath(qop);

            CIMValue v = CM_CIMOM(mb)->invokeMethod(
                *CM_Context(ctx),
                SCMO_ObjectPath(cop)->getNameSpace(),
                qop,
                method ? String(method) : String::EMPTY,
                *CM_Args(in),
                *CM_Args(out));

            CIMType vType=v.getType();
            CMPIType t = type2CMPIType(vType,v.isArray());
            value2CMPIData(v,t,&data);

            if (rc)
            {
                CMSetStatus(rc,CMPI_RC_OK);
            }
        }
        HandlerCatchSetStatus(rc, data);

        PEG_METHOD_EXIT();
        return data; // "data" will be valid data or nullValue (in error case)
    }
Exemple #10
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);
}
Exemple #11
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 ());

}
Exemple #12
0
CIMKeyBinding::CIMKeyBinding(const CIMName& name, const CIMValue& value)
{
    if (value.isArray())
    {
        throw TypeMismatchException();
    }

    String kbValue = value.toString();
    Type kbType;

    switch (value.getType())
    {
    case CIMTYPE_BOOLEAN:
        kbType = BOOLEAN;
        break;
    case CIMTYPE_CHAR16:
    case CIMTYPE_STRING:
    case CIMTYPE_DATETIME:
        kbType = STRING;
        break;
    case CIMTYPE_REFERENCE:
        kbType = REFERENCE;
        break;
//  case CIMTYPE_REAL32:
//  case CIMTYPE_REAL64:
    case CIMTYPE_OBJECT:
    case CIMTYPE_INSTANCE:
        // From PEP 194: EmbeddedObjects cannot be keys.
        throw TypeMismatchException();
        break;
    default:
        kbType = NUMERIC;
        break;
    }

    _rep = new CIMKeyBindingRep(name, kbValue, kbType);
}
Exemple #13
0
void
CIMtoXML(CIMQualifier const& cq, ostream& ostr)
{
	CIMFlavor fv;
	
	if (cq.getName().empty())
	{
		OW_THROWCIMMSG(CIMException::FAILED, "qualifier must have a name");
	}
	CIMValue dv = cq.getDefaults().getDefaultValue();
	CIMDataType dt = cq.getDefaults().getDataType();
	CIMValue cv = cq.getValue();
	if (!cv)
	{
		cv = dv;
	}
	if (cv)
	{
		if (cv.isArray())
		{
			dt = CIMDataType(cv.getType(),cv.getArraySize());
		}
		else
		{
			dt = CIMDataType(cv.getType());
		}
	}
	OW_ASSERT(dt);
	ostr
		<< "<QUALIFIER NAME=\""
		<< cq.getName()
		<< "\" TYPE=\"";
	CIMtoXML(dt,ostr);
	ostr << "\" ";
	if (cq.getPropagated())
	{
		ostr << "PROPAGATED=\"true\" ";
	}
	//
	// Create flavors
	//
	fv = CIMFlavor(CIMFlavor::ENABLEOVERRIDE);
	if (cq.hasFlavor(fv))
	{
		//
		// Not needed, because OVERRIDABLE defaults to true!
	}
	else
	{
		fv = CIMFlavor(CIMFlavor::DISABLEOVERRIDE);
		if (cq.hasFlavor(fv))
		{
			CIMtoXML(fv, ostr);
			ostr <<  "=\"false\" ";
		}
	}
	fv = CIMFlavor(CIMFlavor::TOSUBCLASS);
	if (cq.hasFlavor(fv))
	{
		//
		// Not needed, because TOSUBCLASS defaults to true!
	}
	else
	{
		fv = CIMFlavor(CIMFlavor::RESTRICTED);
		if (cq.hasFlavor(fv))
		{
			CIMtoXML(fv, ostr);
			ostr <<  "=\"false\" ";
		}
	}
	// This is a bug in the spec, but we still support it for backward compatibility.
	//fv = CIMFlavor(CIMFlavor::TOINSTANCE);
	//if (cq.hasFlavor(fv))
	//{
	//	CIMtoXML(fv, ostr);
	//	ostr << "=\"true\" ";
	//}
	//else
	//{
		//
		// Not needed, because TOINSTANCE defaults to false!
	//}
	fv = CIMFlavor(CIMFlavor::TRANSLATE);
	if (cq.hasFlavor(fv))
	{
		CIMtoXML(fv, ostr);
		ostr << "=\"true\" ";
	}
	else
	{
		//
		// Not needed, because TRANSLATABLE defaults to false!
	}

	String lang = cq.getLanguage();
	if (!lang.empty())
	{
		ostr << " xml:lang=\"";
		ostr << lang;
		ostr << '\"';
	}

	ostr << '>';
	if (cv)
	{
		CIMtoXML(cv, ostr);
	}
	ostr << "</QUALIFIER>";
}
Exemple #14
0
void CIMtoXML(CIMValue const& cv, ostream& out)
{
	if (!cv)
	{
		OW_THROWCIMMSG(CIMException::FAILED, "CIM value is NULL");
	}
	if (cv.isArray())
	{
		switch (cv.getType())
		{
			case CIMDataType::BOOLEAN:
			{
				BoolArray a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::UINT8:
			{
				UInt8Array a;
				cv.get(a);
				raToXmlNumeric(out, a);
				break;
			}
			case CIMDataType::SINT8:
			{
				Int8Array a;
				cv.get(a);
				raToXmlNumeric(out, a);
				break;
			}
			// ATTN: UTF8
			case CIMDataType::CHAR16:
			{
				Char16Array a;
				cv.get(a);
				raToXmlChar16(out, a);
				break;
			}
			case CIMDataType::UINT16:
			{
				UInt16Array a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::SINT16:
			{
				Int16Array a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::UINT32:
			{
				UInt32Array a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::SINT32:
			{
				Int32Array a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::UINT64:
			{
				UInt64Array a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::SINT64:
			{
				Int64Array a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::REAL32:
			{
				Real32Array a;
				cv.get(a);
				realArrayToXml(out, a);
				break;
			}
			case CIMDataType::REAL64:
			{
				Real64Array a;
				cv.get(a);
				realArrayToXml(out, a);
				break;
			}
			case CIMDataType::STRING:
			{
				StringArray a;
				cv.get(a);
				raToXmlSA(out, a);
				break;
			}
			case CIMDataType::DATETIME:
			{
				CIMDateTimeArray a;
				cv.get(a);
				raToXml(out, a);
				break;
			}
			case CIMDataType::REFERENCE:
			{
				CIMObjectPathArray a;
				cv.get(a);
				raToXmlCOP(out, a);
				break;
			}
			
			case CIMDataType::EMBEDDEDCLASS:
			{
				CIMClassArray ca;
				cv.get(ca);
				StringArray sa;
				for (size_t i = 0; i < ca.size(); ++i)
				{
					OStringStream ss;
					CIMtoXML(ca[i], ss);
					sa.push_back(ss.toString());
				}
				raToXmlSA(out, sa);
				break;
			}
			
			case CIMDataType::EMBEDDEDINSTANCE:
			{
				CIMInstanceArray ia;
				cv.get(ia);
				StringArray sa;
				for (size_t i = 0; i < ia.size(); ++i)
				{
					OStringStream ss;
					CIMInstancetoXML(ia[i],ss);
					sa.push_back(ss.toString());
				}
				raToXmlSA(out, sa);
				break;
			}
			default:
				OW_ASSERT(0);
		}
	}
	else if (cv.getType() == CIMDataType::REFERENCE)
	{
		out << "<VALUE.REFERENCE>";
		CIMObjectPath a(CIMNULL);
		cv.get(a);
		if (a.getFullNameSpace().isLocal())
		{
			if (a.getNameSpace().empty())
			{
				CIMInstanceNametoXML(a, out);
			}
			else
			{
				CIMLocalInstancePathtoXML(a, out);
			}
		}
		else
		{
			CIMInstancePathtoXML(a, out);
		}
		out << "</VALUE.REFERENCE>";
	}
	else
	{
		out << "<VALUE>";
		switch (cv.getType())
		{
			case CIMDataType::BOOLEAN:
			case CIMDataType::UINT8:
			case CIMDataType::SINT8:
			case CIMDataType::UINT16:
			case CIMDataType::SINT16:
			case CIMDataType::UINT32:
			case CIMDataType::SINT32:
			case CIMDataType::UINT64:
			case CIMDataType::SINT64:
			case CIMDataType::DATETIME:
			{
				out << cv.toString();
				break;
			}
			case CIMDataType::REAL32:
			{
				char tmpbuf[128];
#if FLT_RADIX == 2
#if defined(OW_REAL32_IS_FLOAT)
				::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*e", FLT_MANT_DIG * 3 / 10 + 1, static_cast<double>(cv.toReal32()));
#elif defined(OW_REAL32_IS_DOUBLE)
				::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*e", DBL_MANT_DIG * 3 / 10 + 1, cv.toReal32());
#endif
#else
#error "The formula for computing the number of digits of precision for a floating point needs to be implmented. It's ceiling(bits * log(FLT_RADIX) / log(10))"
#endif
				out << tmpbuf;
				break;
			}
			case CIMDataType::REAL64:
			{
				char tmpbuf[128];
#if FLT_RADIX == 2
#if defined(OW_REAL64_IS_DOUBLE)
				::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*e", DBL_MANT_DIG * 3 / 10 + 1, cv.toReal64());
#elif defined(OW_REAL64_IS_LONG_DOUBLE)
				::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*Le", LDBL_MANT_DIG * 3 / 10 + 1, cv.toReal64());
#endif
#else
#error "The formula for computing the number of digits of precision for a floating point needs to be implmented. It's ceiling(bits * log(FLT_RADIX) / log(10))"
#endif
				out << tmpbuf;
				break;
			}
			case CIMDataType::CHAR16:
			case CIMDataType::STRING:
			{
				out << XMLEscape(cv.toString());
				break;
			}
			
			case CIMDataType::EMBEDDEDCLASS:
			{
				CIMClass cc(CIMNULL);
				cv.get(cc);
				String s;
				OStringStream ss;
				CIMtoXML(cc, ss);
				out << XMLEscape(ss.toString());
				break;
			}
			
			case CIMDataType::EMBEDDEDINSTANCE:
			{
				CIMInstance i(CIMNULL);
				cv.get(i);
				String s;
				OStringStream ss;
				CIMInstancetoXML(i,ss);
				out << XMLEscape(ss.toString());
				break;
			}
			default:
				OW_ASSERT(0);
		}
		out << "</VALUE>";
	}
}
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);
}
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);
}
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();
}
Exemple #18
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);
    }

}
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");
}
/*
    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;
}
Exemple #21
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());
  }
}