⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 processindication.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    try    {        _sendTestIndicationUnmatchingNamespace (client);    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "sendUnmatchingNamespace failed: "                            << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ sendUnmatchingNamespace completed successfully"                       << PEGASUS_STD (endl);}void _sendUnmatchingClassName (CIMClient & client){    try    {        _sendTestIndicationUnmatchingClassName (client);    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "sendUnmatchingClassName failed: "                            << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ sendUnmatchingClassName completed successfully"                       << PEGASUS_STD (endl);}void _check    (const String & opt,     Uint32 id,     const String & methodName,     Boolean allProperties,     Boolean noIndications,     const String & qlang){    Boolean result = _checkIndicationLog (id, methodName, allProperties,        noIndications, qlang);    if (!result)    {        PEGASUS_STD (cerr) << opt << " failed" << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ " << opt << " completed successfully"                       << PEGASUS_STD (endl);}void _delete1 (CIMClient & client){    try    {        _deleteSubscriptionInstance (client, String ("PIFilter01"),            String ("PIHandler01"));    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "delete1 failed: " << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ delete1 completed successfully"                       << PEGASUS_STD (endl);}void _delete2 (CIMClient & client){    try    {        _deleteSubscriptionInstance (client, String ("PIFilter02"),            String ("PIHandler01"));    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "delete2 failed: " << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ delete2 completed successfully"                       << PEGASUS_STD (endl);}void _delete3 (CIMClient & client){    try    {        _deleteSubscriptionInstance (client, String ("PIFilter03"),            String ("PIHandler01"));    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "delete3 failed: " << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ delete3 completed successfully"                       << PEGASUS_STD (endl);}void _delete4 (CIMClient & client){    try    {        _deleteSubscriptionInstance (client, String ("PIFilter04"),            String ("PIHandler01"));    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "delete4 failed: " << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ delete4 completed successfully"                       << PEGASUS_STD (endl);}void _cleanup (CIMClient & client, String & qlang){    try    {        _deleteHandlerInstance (client, String ("PIHandler01"));        _deleteFilterInstance (client, String ("PIFilter01"));        _deleteFilterInstance (client, String ("PIFilter02"));        //        //  Filter03 and Filter04 are not created for WQL because WQL does not         //  support array properties in the WHERE clause        //        if (qlang != "WQL")        {            _deleteFilterInstance (client, String ("PIFilter03"));            _deleteFilterInstance (client, String ("PIFilter04"));        }    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << "cleanup failed: " << e.getMessage ()                           << PEGASUS_STD (endl);        exit (-1);    }    PEGASUS_STD (cout) << "+++++ cleanup completed successfully"                       << PEGASUS_STD (endl);}int _test(CIMClient& client, const char* opt, String& qlang){  if (String::equalNoCase (opt, "setup"))  {     _setup (client, qlang);  }  else if (String::equalNoCase (opt, "create1"))  {    _create1 (client);  }  else if (String::equalNoCase (opt, "create2"))  {    _create2 (client);  }  else if (String::equalNoCase (opt, "create3"))  {    _create3 (client);  }  else if (String::equalNoCase (opt, "create4"))  {    _create4 (client);  }  else if (String::equalNoCase (opt, "sendNormal"))  {    _sendNormal (client);  }  else if (String::equalNoCase (opt, "sendSubclass"))  {    _sendSubclass (client);  }  else if (String::equalNoCase (opt, "sendMissing"))  {    _sendMissing (client);  }  else if (String::equalNoCase (opt, "sendExtra"))  {    _sendExtra (client);  }  else if (String::equalNoCase (opt, "sendMatching"))  {    _sendMatching (client);  }  else if (String::equalNoCase (opt, "sendUnmatchingNamespace"))  {    _sendUnmatchingNamespace (client);  }  else if (String::equalNoCase (opt, "sendUnmatchingClassName"))  {    _sendUnmatchingClassName (client);  }  else if (String::equalNoCase (opt, "checkNormal"))  {    //    //  Check indications received by Simple Display Consumer    //  Only the properties included in the SELECT list of the filter     //  query should be included in the indication instance    //    _check (opt, 1, String ("SendTestIndicationNormal"),             false, false, qlang);  }  else if (String::equalNoCase (opt, "checkSubclass"))  {    //    //  Check indications received by Simple Display Consumer    //  Only the properties included in the SELECT list of the filter    //  query should be included in the indication instance    //    _check (opt, 2, String ("SendTestIndicationSubclass"), false, false, qlang);  }  else if (String::equalNoCase (opt, "checkMissing"))  {    //    //  Check indications received by Simple Display Consumer    //  An indication should be received because the missing property is a    //  project list property, not a property required by the WHERE clause    //    _check (opt, 3,             String ("SendTestIndicationMissingProperty"), false, false, qlang);  }  else if (String::equalNoCase (opt, "checkExtra"))  {    //    //  Check indications received by Simple Display Consumer    //  The extra property added to the indication instance by the     //  indication provider should not appear in the indication    //  Only the properties included in the SELECT list of the filter     //  query should be included in the indication instance    //    _check (opt, 4,             String ("SendTestIndicationExtraProperty"), false, false, qlang);  }  else if (String::equalNoCase (opt, "checkMatching"))  {    //    //  Check indications received by Simple Display Consumer    //  Only the properties included in the SELECT list of the filter     //  query should be included in the indication instance    //    _check (opt, 5,             String ("SendTestIndicationMatchingInstance"), false, false, qlang);  }  else if (String::equalNoCase (opt, "checkUnmatchingNamespace"))  {    //    //  Check indications received by Simple Display Consumer    //  None should be received in this case, since the namespace of     //  the generated indication instance does not match the filter     //  source namespace of the subscription instance name in the     //  operation context    //    _check (opt, 6,             String ("SendTestIndicationUnmatchingNamespace"), false, true, qlang);  }  else if (String::equalNoCase (opt, "checkUnmatchingClassName"))  {    //    //  Check indications received by Simple Display Consumer    //  None should be received in this case, since the class name of     //  the generated indication instance does not match the filter     //  query indication class of the subscription instance name in the    //  operation context    //    _check (opt, 7,             String ("SendTestIndicationUnmatchingClassName"), false, true, qlang);  }  else if (String::equalNoCase (opt, "checkNormalAll"))  {        //    //  Check indications received by Simple Display Consumer    //  All properties should be included in the indication instance,    //  since the filter query specifies SELECT *    //    _check (opt, 8,             String ("SendTestIndicationNormal"), true, false, qlang);   }  else if (String::equalNoCase (opt, "checkMissingAll"))  {    //    //  Check indications received by Simple Display Consumer    //  An indication should be received because the missing property is a    //  project list property, not a property required by the WHERE clause    //    _check (opt, 9,             String ("SendTestIndicationMissingProperty"), true, false, qlang);  }  else if (String::equalNoCase (opt, "checkExtraAll"))  {    //    //  Check indications received by Simple Display Consumer    //  The extra property added to the indication instance by the     //  indication provider should not appear in the indication    //  All properties should be included in the indication instance,    //  since the filter query specifies SELECT *    //    _check (opt, 10,             String ("SendTestIndicationExtraProperty"), true, false, qlang);  }  else if (String::equalNoCase (opt, "checkNormalWhere"))  {    //    //  Check indications received by Simple Display Consumer    //  An indication should be received because the generated indication    //  satisfies the WHERE clause condition    //  Only the properties included in the SELECT list of the filter     //  query should be included in the indication instance    //    _check (opt, 11, String ("SendTestIndicationNormal"),             false, false, qlang);  }  else if (String::equalNoCase (opt, "checkMissingWhere"))  {    //    //  Check indications received by Simple Display Consumer    //  No indication should be received because the missing property is a    //  property required by the WHERE clause    //    _check (opt, 12,             String ("SendTestIndicationMissingProperty"), false, true, qlang);  }  else if (String::equalNoCase (opt, "checkNormalWhereNotSatisfied"))  {        //    //  Check indications received by Simple Display Consumer    //  No indication should be received because the generated instance does    //  not satisfy the WHERE clause condition    //    _check (opt, 13,             String ("SendTestIndicationNormal"), true, true, qlang);   }  else if (String::equalNoCase (opt, "delete1"))  {    _delete1 (client);  }  else if (String::equalNoCase (opt, "delete2"))  {    _delete2 (client);  }  else if (String::equalNoCase (opt, "delete3"))  {    _delete3 (client);  }  else if (String::equalNoCase (opt, "delete4"))  {    _delete4 (client);  }  else if (String::equalNoCase (opt, "cleanup"))  {    _cleanup (client, qlang);  }  else  {    PEGASUS_STD (cerr) << "Invalid option: " << opt                        << PEGASUS_STD (endl);    _usage ();    return -1;  }  return 0;}int main (int argc, char** argv){    CIMClient client;    try    {        client.connectLocal ();    }    catch (Exception & e)    {        PEGASUS_STD (cerr) << e.getMessage () << PEGASUS_STD (endl);        return -1;    }    if (argc != 3)    {        _usage ();        return 1;    }    else    {        const char * opt = argv [1];        const char * optLang = argv [2];        String qlang(optLang);#ifdef PEGASUS_DISABLE_CQL        if (qlang == "DMTF:CQL")        {          PEGASUS_STD (cout) << "+++++ cql test disabled" << PEGASUS_STD (endl);          return 0;        }        else        {          return _test(client, opt, qlang);        }#else        return _test(client, opt, qlang);#endif    }    PEGASUS_UNREACHABLE( return 0; )}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -