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

📄 testdatatype.java

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                System.err.println ("Setting an array of sint8s");            }            cimInstance.setProperty ("PropertyArraySint8", cv);            // get SINT8_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArraySint8");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            Byte si8[] = (Byte[])o;            if (DEBUG)            {                System.err.print ("si8         = [");                for (int i = 0; i < si8.length; i++)                {                    System.err.print (si8[i]);                    if (i < si8.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestUINT16_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set UINT16_ARRAY            CIMValue cv           = null;            Vector   vectorUINT16 = new Vector ();            vectorUINT16.addElement (new UnsignedInt16 ((int)65535));            vectorUINT16.addElement (new UnsignedInt16 ((int)33333));            vectorUINT16.addElement (new UnsignedInt16 ((int)11111));            cv = new CIMValue (vectorUINT16, new CIMDataType (CIMDataType.UINT16_ARRAY));            if (DEBUG)            {                System.err.println ("cv           = " + cv);                System.err.println ("Setting an array of uint16s");            }            cimInstance.setProperty ("PropertyArrayUint16", cv);            // get UINT16_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArrayUint16");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            UnsignedInt16 ui16[] = (UnsignedInt16[])o;            if (DEBUG)            {                System.err.print ("ui16        = [");                for (int i = 0; i < ui16.length; i++)                {                    System.err.print (ui16[i]);                    if (i < ui16.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestSINT16_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set SINT16_ARRAY            CIMValue cv           = null;            Vector   vectorSINT16 = new Vector ();            vectorSINT16.addElement (new Short ((byte)0));            vectorSINT16.addElement (new Short ((byte)-6173));            vectorSINT16.addElement (new Short ((byte)-32768));            cv = new CIMValue (vectorSINT16, new CIMDataType (CIMDataType.SINT16_ARRAY));            if (DEBUG)            {                System.err.println ("cv           = " + cv);                System.err.println ("Setting an array of sint16s");            }            cimInstance.setProperty ("PropertyArraySint16", cv);            // get SINT16_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArraySint16");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            Short si16[] = (Short[])o;            if (DEBUG)            {                System.err.print ("si16        = [");                for (int i = 0; i < si16.length; i++)                {                    System.err.print (si16[i]);                    if (i < si16.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestUINT32_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set UINT32_ARRAY            CIMValue cv           = null;            Vector   vectorUINT32 = new Vector ();            vectorUINT32.addElement (new UnsignedInt32 (4294967295L));            vectorUINT32.addElement (new UnsignedInt32 (2222222222L));            vectorUINT32.addElement (new UnsignedInt32 (108L));            cv = new CIMValue (vectorUINT32, new CIMDataType (CIMDataType.UINT32_ARRAY));            if (DEBUG)            {                System.err.println ("cv           = " + cv);                System.err.println ("Setting an array of uint32s");            }            cimInstance.setProperty ("PropertyArrayUint32", cv);            // get UINT32_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArrayUint32");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            UnsignedInt32 ui32[] = (UnsignedInt32[])o;            if (DEBUG)            {                System.err.print ("ui32        = [");                for (int i = 0; i < ui32.length; i++)                {                    System.err.print (ui32[i]);                    if (i < ui32.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestSINT32_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set SINT32_ARRAY            CIMValue cv           = null;            Vector   vectorSINT32 = new Vector ();            vectorSINT32.addElement (new Integer (-12345));            vectorSINT32.addElement (new Integer (2147483647));            vectorSINT32.addElement (new Integer (-2147483648));            cv = new CIMValue (vectorSINT32, new CIMDataType (CIMDataType.SINT32_ARRAY));            if (DEBUG)            {                System.err.println ("cv           = " + cv);                System.err.println ("Setting an array of sint32s");            }            cimInstance.setProperty ("PropertyArraySint32", cv);            // get SINT32_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArraySint32");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            Integer si32[] = (Integer[])o;            if (DEBUG)            {                System.err.print ("si32        = [");                for (int i = 0; i < si32.length; i++)                {                    System.err.print (si32[i]);                    if (i < si32.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestUINT64_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set UINT64_ARRAY            String   apszValues[] = {               "7482743276264381934",               "11122233344455566677",               "18446744073709551615"            };            CIMValue cv           = null;            Vector   vectorUINT64 = new Vector ();            int      idxValue     = 0;            vectorUINT64.addElement (new UnsignedInt64 (new BigInteger (apszValues[idxValue++])));            vectorUINT64.addElement (new UnsignedInt64 (new BigInteger (apszValues[idxValue++])));            vectorUINT64.addElement (new UnsignedInt64 (new BigInteger (apszValues[idxValue++])));            cv = new CIMValue (vectorUINT64, new CIMDataType (CIMDataType.UINT64_ARRAY));            if (DEBUG)            {                System.err.println ("cv           = " + cv);                System.err.println ("Setting an array of uint64s");            }            cimInstance.setProperty ("PropertyArrayUint64", cv);            // get UINT64_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArrayUint64");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            UnsignedInt64 aui64[] = (UnsignedInt64[])o;            if (DEBUG)            {                System.err.print ("aui64       = [");                for (int i = 0; i < aui64.length; i++)                {                    System.err.print (aui64[i]);                    if (i < aui64.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            for (int i = 0; i < aui64.length; i++)            {               BigInteger    bi   = new BigInteger (apszValues[i]);               UnsignedInt64 ui64 = new UnsignedInt64 (bi);               if (aui64[i].compareTo ((Object)ui64) != 0)               {                  return false;               }            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestSINT64_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set SINT64_ARRAY            CIMValue cv = null;            Vector vectorSINT64 = new Vector ();            vectorSINT64.addElement (new Long (1736513846286344121L));            vectorSINT64.addElement (new Long (-9223372036854775808L));            vectorSINT64.addElement (new Long (9223372036854775807L));            cv = new CIMValue (vectorSINT64, new CIMDataType (CIMDataType.SINT64_ARRAY));            if (DEBUG)            {                System.err.println ("cv           = " + cv);                System.err.println ("Setting an array of sint64s");            }            cimInstance.setProperty ("PropertyArraySint64", cv);            // get SINT64_ARRAY            CIMProperty cp = null;            cp = cimInstance.getProperty ("PropertyArraySint64");            if (DEBUG)                System.err.println ("cp          = " + cp);            cv = cp.getValue ();            if (DEBUG)                System.err.println ("cv          = " + cv);            Object o = cv.getValue (false);            if (DEBUG)                System.err.println ("o           = " + o);            Long si64[] = (Long[])o;            if (DEBUG)            {                System.err.print ("si64        = [");                for (int i = 0; i < si64.length; i++)                {                    System.err.print (si64[i]);                    if (i < si64.length - 1)                        System.err.print (",");                }                System.err.println ("]");            }            return true;        }        catch (Exception e)        {            System.out.println ("Caught " + e);            e.printStackTrace ();            return false;        }    }    private boolean runTestSTRING_ARRAY (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop)    {        try        {            // set STRING_ARRAY            CIMValue cv           = null;            Vector   vectorSTRING = new Vector ();            vectorSTRING.addElement (new String ("Hello World."));            vectorSTRING.addElement (new String ("This is a test."));            vectorSTRING.addElement (new String ("Bob lives!"));            cv = new CIMValue (vectorSTRING, new CIMDataType (CIMDataType.STRING_ARRAY));            if (DEBUG)            {

⌨️ 快捷键说明

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