📄 testcimclient.java
字号:
//8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Enumerate class: enumerateClassNames"); } enm = cimClient.enumerateClassNames (cop, true); // deepInheritance if (DEBUG) { System.err.println ("enm = " + enm); } if ( enm == null || !enm.hasMoreElements () ) { System.out.println ("FAIL (10): testCIMClient: enumerateClassNames"); return false; } // @TBD this object path doesn't have the hostname while the one // above does. copRet = (CIMObjectPath)enm.nextElement (); if (DEBUG) { System.err.println ("copRet = " + copRet); } // There should be only one object path if (enm.hasMoreElements ()) { System.out.println ("FAIL (11): testCIMClient: enumerateClassNames"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- cop = new CIMObjectPath (classNameInstanceChild, nameSpaceClass); if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Enumerate instance: enumInstances"); } enm = cimClient.enumInstances (cop, true); // deepInheritance if (DEBUG) { System.err.println ("enm = " + enm); } if ( enm == null || !enm.hasMoreElements () ) { System.out.println ("FAIL (12): testCIMClient: enumInstances"); return false; } while (enm.hasMoreElements ()) { copRet = (CIMObjectPath)enm.nextElement (); if (DEBUG) { System.err.println ("copRet = " + copRet); } } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Enumerate instance: enumerateInstanceNames"); } enm = cimClient.enumerateInstanceNames (cop); if (DEBUG) { System.err.println ("enm = " + enm); } if ( enm == null || !enm.hasMoreElements () ) { System.out.println ("FAIL (13): testCIMClient: enumerateInstanceNames"); return false; } while (enm.hasMoreElements ()) { copRet = (CIMObjectPath)enm.nextElement (); if (DEBUG) { System.err.println ("copRet = " + copRet); } } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Enumerate instance: enumInstances"); } enm = cimClient.enumInstances (cop, true, // deepInheritance true); // localOnly if (DEBUG) { System.err.println ("enm = " + enm); } if ( enm == null || !enm.hasMoreElements () ) { System.out.println ("FAIL (14): testCIMClient: enumInstances"); return false; } CIMInstance ci = null; while (enm.hasMoreElements ()) { ci = (CIMInstance)enm.nextElement (); if (DEBUG) { System.err.println ("ci = " + ci); } } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Enumerate instance: enumerateInstances"); } enm = cimClient.enumerateInstances (cop, true, // deepInheritance true, // localOnly true, // includeQualifiers true, // includeClassOrigin null); // propertyList if (DEBUG) { System.err.println ("enm = " + enm); } if ( enm == null || !enm.hasMoreElements () ) { System.out.println ("FAIL (15): testCIMClient: enumerateInstances"); return false; } while (enm.hasMoreElements ()) { ci = (CIMInstance)enm.nextElement (); if (DEBUG) { System.err.println ("ci = " + ci); } } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- cop = new CIMObjectPath (classNameInstanceChild, nameSpaceClass); if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Get class: getClass (,)"); } cc = cimClient.getClass (cop, true); // localOnly if (DEBUG) { System.err.println ("cc = " + cc); } if (cc == null) { System.out.println ("FAIL (16): testCIMClient: getClass"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Get class: getClass (,,,)"); } cc = cimClient.getClass (cop, true, // localOnly true, // includeQualifiers, true, // includeClassOrigin, null); // propertyList if (DEBUG) { System.err.println ("cc = " + cc); } if (cc == null) { System.out.println ("FAIL (17): testCIMClient: getClass"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- Vector kvp = new Vector (); kvp.addElement (new CIMProperty ("CreationClassName", new CIMValue (classNameInstanceChild))); kvp.addElement (new CIMProperty ("InstanceId", new CIMValue (new UnsignedInt64 ("1")))); cop = new CIMObjectPath (classNameInstanceChild, kvp); cop.setNameSpace (nameSpaceClass); if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Get instance: getInstance (,)"); } ci = cimClient.getInstance (cop, true); // localOnly if (DEBUG) { System.err.println ("ci = " + ci); } if (ci == null) { System.out.println ("FAIL (18): testCIMClient: getInstance"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Get instance: getInstance (,,,)"); } ci = cimClient.getInstance (cop, true, // localOnly true, // includeQualifiers, true, // includeClassOrigin, null); // propertyList if (DEBUG) { System.err.println ("ci = " + ci); } if (ci == null) { System.out.println ("FAIL (19): testCIMClient: getInstance"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Invoke method with vector"); } Vector vectorInParams = new Vector (); Vector vectorOutParams = new Vector (); CIMValue cv = null; cv = cimClient.invokeMethod (cop, "sayHello", vectorInParams, vectorOutParams); if (DEBUG) { System.err.println ("cv = " + cv); } if ( ci == null || !((String)cv.getValue ()).equals ("hello") ) { System.out.println ("FAIL (20): testCIMClient: invokeMethod"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Invoke method with array"); } CIMArgument[] arrayInParams = null; CIMArgument[] arrayOutParams = null; cv = cimClient.invokeMethod (cop, "sayHello", arrayInParams, arrayOutParams); if (DEBUG) { System.err.println ("cv = " + cv); } if ( ci == null || !((String)cv.getValue ()).equals ("hello") ) { System.out.println ("FAIL (21): testCIMClient: invokeMethod"); return false; } //8<--------8<--------8<--------8<--------8<--------8<--------8<-------- CIMQualifierType cqt = null; if (DEBUG) { System.err.println ("cop = " + cop); System.err.println ("Enumerate qualifiers: enumQualifierTypes"); } enm = cimClient.enumQualifierTypes (cop); if (DEBUG) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -