📄 testdatatype.java
字号:
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation, The Open Group.// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions://// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////%/////////////////////////////////////////////////////////////////////////////package Client;import java.math.BigInteger;import java.util.Vector;import org.pegasus.jmpi.CIMClass;import org.pegasus.jmpi.CIMClient;import org.pegasus.jmpi.CIMDataType;import org.pegasus.jmpi.CIMDateTime;import org.pegasus.jmpi.CIMException;import org.pegasus.jmpi.CIMInstance;import org.pegasus.jmpi.CIMObject;import org.pegasus.jmpi.CIMObjectPath;import org.pegasus.jmpi.CIMProperty;import org.pegasus.jmpi.CIMValue;import org.pegasus.jmpi.UnsignedInt16;import org.pegasus.jmpi.UnsignedInt32;import org.pegasus.jmpi.UnsignedInt64;import org.pegasus.jmpi.UnsignedInt8;public class testDataType{ private final String className = "JMPIExpInstance_TestPropertyTypes"; private final String nameSpaceClass = "root/SampleProvider"; private boolean DEBUG = false; /** * This returns the group name. * * @return String "class" testcase belongs in. */ public String getGroup () { return "instances"; } public void setDebug (boolean fDebug) { DEBUG = fDebug; } public boolean main (String args[], CIMClient cimClient) { boolean fExecuted = false; for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase ("debug")) { setDebug (true); } } if (!fExecuted) return runTests (cimClient); return false; } public boolean runTests (CIMClient cimClient) { try { return runTest (cimClient); } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTest (CIMClient cimClient) throws CIMException, Exception { CIMObjectPath copTest = null; CIMInstance cimInstance = null; boolean fRet = true; copTest = new CIMObjectPath (className, nameSpaceClass); if (copTest == null) { System.err.println ("ERROR: Could not create a CIMObjectPath ('" + className + "', '" + nameSpaceClass + "');"); return false; } copTest.addKey ("CreationClassName", new CIMValue (new String (className))); copTest.addKey ("InstanceId", new CIMValue (new UnsignedInt64 ("1"))); if (DEBUG) { System.err.println ("copTest = " + copTest); } cimInstance = cimClient.getInstance (copTest, false); if (DEBUG) { System.err.println ("cimInstance = " + cimInstance); } if (runTestUINT8 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT8."); } else { System.out.println ("ERROR: UINT8 failed!"); return false; } if (runTestSINT8 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT8."); } else { System.out.println ("ERROR: SINT8 failed!"); return false; } if (runTestUINT16 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT16."); } else { System.out.println ("ERROR: UINT16 failed!"); return false; } if (runTestSINT16 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT16."); } else { System.out.println ("ERROR: SINT16 failed!"); return false; } if (runTestUINT32 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT32."); } else { System.out.println ("ERROR: UINT32 failed!"); return false; } if (runTestSINT32 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT32."); } else { System.out.println ("ERROR: SINT32 failed!"); return false; } if (runTestUINT64 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT64."); } else { System.out.println ("ERROR: UINT64 failed!"); return false; } if (runTestSINT64 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT64."); } else { System.out.println ("ERROR: SINT64 failed!"); return false; } if (runTestSTRING (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: STRING."); } else { System.out.println ("ERROR: STRING failed!"); return false; } if (runTestBOOLEAN (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: BOOLEAN."); } else { System.out.println ("ERROR: BOOLEAN failed!"); return false; } if (runTestREAL32 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: REAL32."); } else { System.out.println ("ERROR: REAL32 failed!"); return false; } if (runTestREAL64 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: REAL64."); } else { System.out.println ("ERROR: REAL64 failed!"); return false; } if (runTestDATETIME (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: DATETIME."); } else { System.out.println ("ERROR: DATETIME failed!"); return false; } if (runTestCHAR16 (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: CHAR16."); } else { System.out.println ("ERROR: CHAR16 failed!"); return false; } if (runTestINSTANCE (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: INSTANCE."); } else { System.out.println ("ERROR: INSTANCE failed!"); return false; } if (runTestCLASS (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: CLASS."); } else { System.out.println ("ERROR: CLASS failed!"); return false; } if (runTestUINT8_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT8_ARRAY."); } else { System.out.println ("ERROR: UINT8_ARRAY failed!"); return false; } if (runTestSINT8_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT8_ARRAY."); } else { System.out.println ("ERROR: SINT8_ARRAY failed!"); return false; } if (runTestUINT16_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT16_ARRAY."); } else { System.out.println ("ERROR: UINT16_ARRAY failed!"); return false; } if (runTestSINT16_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT16_ARRAY."); } else { System.out.println ("ERROR: SINT16_ARRAY failed!"); return false; } if (runTestUINT32_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT32_ARRAY."); } else { System.out.println ("ERROR: UINT32_ARRAY failed!"); return false; } if (runTestSINT32_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT32_ARRAY."); } else { System.out.println ("ERROR: SINT32_ARRAY failed!"); return false; } if (runTestUINT64_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: UINT64_ARRAY."); } else { System.out.println ("ERROR: UINT64_ARRAY failed!"); return false; } if (runTestSINT64_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: SINT64_ARRAY."); } else { System.out.println ("ERROR: SINT64_ARRAY failed!"); return false; } if (runTestSTRING_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: STRING_ARRAY."); } else { System.out.println ("ERROR: STRING_ARRAY failed!"); return false; } if (runTestBOOLEAN_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: BOOLEAN_ARRAY."); } else { System.out.println ("ERROR: BOOLEAN_ARRAY failed!"); return false; } if (runTestREAL32_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: REAL32_ARRAY."); } else { System.out.println ("ERROR: REAL32_ARRAY failed!"); return false; } if (runTestREAL64_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: REAL64_ARRAY."); } else { System.out.println ("ERROR: REAL64_ARRAY failed!"); return false; } if (runTestDATETIME_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: DATETIME_ARRAY."); } else { System.out.println ("ERROR: DATETIME_ARRAY failed!"); return false; } if (runTestCHAR16_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: CHAR16_ARRAY."); } else { System.out.println ("ERROR: CHAR16_ARRAY failed!"); return false; } if (runTestINSTANCE_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: INSTANCE_ARRAY."); } else { System.out.println ("ERROR: INSTANCE_ARRAY failed!"); return false; } if (runTestCLASS_ARRAY (cimClient, cimInstance, copTest)) { System.out.println ("SUCCESS: CLASS_ARRAY."); } else { System.out.println ("ERROR: CLASS_ARRAY failed!"); } return fRet; } private boolean runTestUINT8 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set UINT8 CIMValue cv = null;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -