void _addSubscription (CIMClient & client, String & filter, String & handler) { CIMObjectPath path; CIMInstance retrievedInstance; // // Create subscriptions // CIMInstance subscription01 = _buildSubscriptionInstance (_buildFilterOrHandlerPath (PEGASUS_CLASSNAME_INDFILTER, filter), PEGASUS_CLASSNAME_INDHANDLER_CIMXML, _buildFilterOrHandlerPath (PEGASUS_CLASSNAME_INDHANDLER_CIMXML, handler)); _addUint16Property (subscription01, "OnFatalErrorPolicy", 2); _addStringProperty (subscription01, "OtherOnFatalErrorPolicy", String::EMPTY, true); _addUint64Property (subscription01, "FailureTriggerTimeInterval", 60); _addUint16Property (subscription01, "SubscriptionState", 2); _addStringProperty (subscription01, "OtherSubscriptionState", String::EMPTY, true); _addUint64Property (subscription01, "SubscriptionDuration", PEGASUS_UINT64_LITERAL (60000000000)); _addUint16Property (subscription01, "RepeatNotificationPolicy", 1); _addStringProperty (subscription01, "OtherRepeatNotificationPolicy", "another policy"); _addUint64Property (subscription01, "RepeatNotificationInterval", 60); _addUint64Property (subscription01, "RepeatNotificationGap", 30); _addUint16Property (subscription01, "RepeatNotificationCount", 5); path = client.createInstance (NAMESPACE, subscription01); _checkSubscriptionPath (path, filter, PEGASUS_CLASSNAME_INDHANDLER_CIMXML, handler); retrievedInstance = client.getInstance (NAMESPACE, path); _checkUint16Property (retrievedInstance, "OnFatalErrorPolicy", 2); _checkStringProperty (retrievedInstance, "OtherOnFatalErrorPolicy", String::EMPTY, true); _checkUint64Property (retrievedInstance, "FailureTriggerTimeInterval", 60); _checkUint16Property (retrievedInstance, "SubscriptionState", 2); _checkStringProperty (retrievedInstance, "OtherSubscriptionState", String::EMPTY, true); _checkUint64Property (retrievedInstance, "SubscriptionDuration", PEGASUS_UINT64_LITERAL (60000000000)); _checkUint16Property (retrievedInstance, "RepeatNotificationPolicy", 1); _checkStringProperty (retrievedInstance, "OtherRepeatNotificationPolicy", "another policy"); _checkUint64Property (retrievedInstance, "RepeatNotificationInterval", 60); _checkUint64Property (retrievedInstance, "RepeatNotificationGap", 30); _checkUint16Property (retrievedInstance, "RepeatNotificationCount", 5); }
static void _test1 (CIMClient & client, const String & ql) { try { for (Uint32 i = 0; i < QUERIES; i++) { if (verbose) cerr << "Querying " << queries[i] << endl; Array < CIMObject > objects = client.execQuery (providerNamespace, ql, queries[i]); if (objects.size () == 0) { // Only the third (second when starting from zero) // and eight(7) won't return instances. //PEGASUS_TEST_ASSERT(i == 2 || i == 5 || i == 7 // || i == 8 || i == 12); if (verbose) cerr <<i<< " No instance returned.. That is good" << endl; } for (Uint32 i = 0; i < objects.size (); i++) { if (objects[i].isInstance ()) { CIMInstance inst (objects[i]); if (inst.findProperty ("ElementName") != PEG_NOT_FOUND) _checkStringProperty (inst, "ElementName", "TestCMPI_ExecQuery"); if (inst.findProperty ("s") != PEG_NOT_FOUND) _checkStringProperty (inst, "s", "s"); if (inst.findProperty ("n32") != PEG_NOT_FOUND) _checkUint32Property (inst, "n32", 32); if (inst.findProperty ("n64") != PEG_NOT_FOUND) _checkUint64Property (inst, "n64", 64); if (inst.findProperty ("n16") != PEG_NOT_FOUND) _checkUint16Property (inst, "n16", 16); } } } } catch (const Exception & e) { cerr << "test failed: " << e.getMessage () << endl; exit (-1); } }
void _addHandler (CIMClient & client, String & handler, String & dest) { CIMObjectPath path; CIMInstance retrievedInstance; // // Create persistent CIMXML handler // CIMInstance handler01 (PEGASUS_CLASSNAME_INDHANDLER_CIMXML); _addStringProperty (handler01, "SystemCreationClassName", System::getSystemCreationClassName ()); _addStringProperty (handler01, "SystemName", System::getFullyQualifiedHostName ()); _addStringProperty (handler01, "CreationClassName", PEGASUS_CLASSNAME_INDHANDLER_CIMXML.getString ()); _addStringProperty (handler01, "Name", handler); _addStringProperty (handler01, "Owner", "an owner"); _addUint16Property (handler01, "PersistenceType", 2); _addStringProperty (handler01, "OtherPersistenceType", String::EMPTY, true); _addStringProperty (handler01, "Destination", dest); path = client.createInstance (NAMESPACE, handler01); _checkFilterOrHandlerPath (path, PEGASUS_CLASSNAME_INDHANDLER_CIMXML, handler); retrievedInstance = client.getInstance (NAMESPACE, path); _checkStringProperty (retrievedInstance, "SystemCreationClassName", System::getSystemCreationClassName ()); _checkStringProperty (retrievedInstance, "SystemName", System::getFullyQualifiedHostName ()); _checkStringProperty (retrievedInstance, "CreationClassName", PEGASUS_CLASSNAME_INDHANDLER_CIMXML.getString ()); _checkStringProperty (retrievedInstance, "Name", handler); _checkStringProperty (retrievedInstance, "Owner", "an owner"); _checkUint16Property (retrievedInstance, "PersistenceType", 2); _checkStringProperty (retrievedInstance, "OtherPersistenceType", String::EMPTY, true); _checkStringProperty (retrievedInstance, "Destination", dest); }