////////////////////////////////////////////////////////////////////////////// // TestObj.mof contains: // Class definition for MSFT_EssTestTestObj // // TestObj Event Generator definitions for ESSTest // This is used to test permanent and temporary monitors. #pragma namespace("\\\\.\\root\\cimv2") ////////////////////////////////////////////////////////////////////////////// // MSFT_EssTestPermMonitorObj (instances created/deleted by DoTestObj.js) class MSFT_EssTestPermMonitorObj { [key] uint32 Index; }; instance of MSFT_EssEventGenerator as $Gen1 { Name = "TestObj Perm Monitor Event Generator"; CommandLine = "cscript DoTestObj.js %NumEvents% 10000 0"; FullCompare = false; Script = "var nEvents = WScript.Arguments(0),\n" " type = %ScriptRule%;\n" " \n" "PrintMOF();\n" "\n" "function PrintMOF()\n" "{\n" " var Obj,\n" " nTotal = 0;\n" "\n" " // Initial asserts\n" " if (type & 1)\n" " {\n" " for (Index = 0; Index < nEvents; Index++)\n" " {\n" " nTotal++;\n" "\n" " Obj = \n" " \"instance of __MonitorAssertEvent \" +\n" " \"{ \" +\n" " \" MonitorName = \\\"MSFT_EssTestPermMonitorObj Monitor\\\"; \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \" GuaranteedNew = false;\" +\n" " \" RowObject = \" +\n" " \" instance of MSFT_EssTestPermMonitorObj \"+\n" " \" {\"+\n" " \" \" + // No data here because we can't predict the order.\n" " \" };\" +\n" " \"};\";\n" "\n" " WScript.Echo(Obj);\n" " }\n" " }\n" " \n" " // Monitor up\n" " if (type & 2)\n" " {\n" " Obj =\n" " \"instance of __MonitorUpEvent \" +\n" " \"{ \" +\n" " \" MonitorName = \\\"MSFT_EssTestPermMonitorObj Monitor\\\"; \" +\n" " \" TotalObjects = \" + nEvents + \";\" +\n" " \"};\"\n" "\n" " WScript.Echo(Obj);\n" " }\n" " \n" " // More asserts\n" " if (type & 4)\n" " {\n" " for (Index = nEvents; Index < nEvents * 2; Index++)\n" " {\n" " nTotal++\n" " \n" " Obj = \n" " \"instance of __MonitorAssertEvent \" +\n" " \"{ \" +\n" " \" MonitorName = \\\"MSFT_EssTestPermMonitorObj Monitor\\\"; \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \" GuaranteedNew = true;\" +\n" " \" RowObject = \" +\n" " \" instance of MSFT_EssTestPermMonitorObj \"+\n" " \" {\"+\n" " \" Index = \" + Index + \";\" +\n" " \" };\" +\n" " \"};\";\n" "\n" " WScript.Echo(Obj);\n" " }\n" " }\n" " \n" " // Retracts\n" " if (type & 8)\n" " {\n" " for (Index = (nEvents * 2) - 1; Index >= 0; Index--)\n" " {\n" " nTotal--;\n" "\n" " Obj = \n" " \"instance of __MonitorRetractEvent \" +\n" " \"{ \" +\n" " \" MonitorName = \\\"MSFT_EssTestTestObjMonitor\\\"; \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \" GuaranteedNew = false;\" +\n" " \" RowObject = \" +\n" " \" instance of MSFT_EssTestTestObj \"+\n" " \" {\"+\n" " \" Index = \" + Index + \";\" +\n" " \" };\" +\n" " \"};\";\n" "\n" " WScript.Echo(Obj);\n" " }\n" " }\n" "\n" " // Monitor down\n" " if (type & 16)\n" " {\n" " Obj =\n" " \"instance of __MonitorDownEvent \" +\n" " \"{ \" +\n" " \" MonitorName = \\\"MSFT_EssTestTestObjMonitor\\\"; \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \"};\"\n" "\n" " WScript.Echo(Obj);\n" " }\n" "};\n"; }; instance of MSFT_EssTestWorkItem { Name = "MSFT_EssTestPermMonitorObj events (perm monitor)"; EventGenerator = $Gen1; Enabled = false; NumEvents = 20; TimesToExecute = 1; MaxPermConsumers = 5; MaxTempConsumers = 5; SlowDownProviders = true; }; instance of MSFT_EssTestFilter { Name = "Perm Monitor: all"; EventGenerator = $Gen1; Query = "select * from __MonitorEvent where " "MonitorName = \"MSFT_EssTestPermMonitorObj Monitor\""; ScriptRule = "31"; // All bits set Behavior = 1; }; ////////////////////////////////////////////////////////////////////////////// // MSFT_EssTestTempMonitorObj (instances created/deleted by DoTestObj.js) class MSFT_EssTestTempMonitorObj { [key] uint32 Index; }; instance of MSFT_EssEventGenerator as $Gen2 { Name = "TestObj Temp Monitor Event Generator"; CommandLine = "cscript DoTestObj.js %NumEvents% 10000 1"; FullCompare = false; Script = "var nEvents = WScript.Arguments(0),\n" " type = %ScriptRule%;\n" " \n" "PrintMOF();\n" "\n" "function PrintMOF()\n" "{\n" " var Obj,\n" " nTotal = 0;\n" "\n" " // Initial asserts\n" " if (type & 1)\n" " {\n" " for (Index = 0; Index < nEvents; Index++)\n" " {\n" " nTotal++;\n" "\n" " Obj = \n" " \"instance of __MonitorAssertEvent \" +\n" " \"{ \" +\n" " // No monitor name because you can't predict it for temp. \n" " // monitors.\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \" GuaranteedNew = false;\" +\n" " \" RowObject = \" +\n" " \" instance of MSFT_EssTestTempMonitorObj \"+\n" " \" {\"+\n" " \" \" + // No data here because we can't predict the order.\n" " \" };\" +\n" " \"};\";\n" "\n" " WScript.Echo(Obj);\n" " }\n" " }\n" " \n" " // Monitor up\n" " if (type & 2)\n" " {\n" " Obj =\n" " \"instance of __MonitorUpEvent \" +\n" " \"{ \" +\n" " \" TotalObjects = \" + nEvents + \";\" +\n" " \"};\"\n" "\n" " WScript.Echo(Obj);\n" " }\n" " \n" " // More asserts\n" " if (type & 4)\n" " {\n" " for (Index = nEvents; Index < nEvents * 2; Index++)\n" " {\n" " nTotal++\n" " \n" " Obj = \n" " \"instance of __MonitorAssertEvent \" +\n" " \"{ \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \" GuaranteedNew = true;\" +\n" " \" RowObject = \" +\n" " \" instance of MSFT_EssTestTempMonitorObj \"+\n" " \" {\"+\n" " \" Index = \" + Index + \";\" +\n" " \" };\" +\n" " \"};\";\n" "\n" " WScript.Echo(Obj);\n" " }\n" " }\n" " \n" " // Retracts\n" " if (type & 8)\n" " {\n" " for (Index = (nEvents * 2) - 1; Index >= 0; Index--)\n" " {\n" " nTotal--;\n" "\n" " Obj = \n" " \"instance of __MonitorRetractEvent \" +\n" " \"{ \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \" GuaranteedNew = false;\" +\n" " \" RowObject = \" +\n" " \" instance of MSFT_EssTestTestObj \"+\n" " \" {\"+\n" " \" Index = \" + Index + \";\" +\n" " \" };\" +\n" " \"};\";\n" "\n" " WScript.Echo(Obj);\n" " }\n" " }\n" "\n" " // Monitor down\n" " if (type & 16)\n" " {\n" " Obj =\n" " \"instance of __MonitorDownEvent \" +\n" " \"{ \" +\n" " \" TotalObjects = \" + nTotal + \";\" +\n" " \"};\"\n" "\n" " WScript.Echo(Obj);\n" " }\n" "};\n"; }; instance of MSFT_EssTestWorkItem { Name = "MSFT_EssTestTempMonitorObj events (temp monitor)"; EventGenerator = $Gen2; Enabled = false; NumEvents = 20; TimesToExecute = 1; MaxPermConsumers = 5; MaxTempConsumers = 5; SlowDownProviders = true; }; instance of MSFT_EssTestFilter { Name = "Temp Monitor: all"; EventGenerator = $Gen2; Query = "select * from __MonitorEvent where " "MonitorName <> \"MSFT_EssTestPermMonitorObj Monitor\""; ScriptRule = "31"; // All bits set Behavior = 1; };