|
From: Dave B. <bla...@us...> - 2012-04-13 12:19:17
|
Update of /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/cim
In directory vz-cvs-3.sog:/tmp/cvs-serv7531/utst/org/sblim/cimclient/unittest/cim
Modified Files:
CIMObjectPathTest.java
Log Message:
3510090 - Fix CIMObjectPath.toString() inconsistencies
Index: CIMObjectPathTest.java
===================================================================
RCS file: /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/cim/CIMObjectPathTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- CIMObjectPathTest.java 14 Mar 2012 10:58:12 -0000 1.15
+++ CIMObjectPathTest.java 13 Apr 2012 12:19:14 -0000 1.16
@@ -25,6 +25,7 @@
* 2944824 2010-02-08 blaschke-oss Missing getXmlSchemaName() in CIMObjectPath
* 3374012 2011-07-24 blaschke-oss Sblim client CIMObjectPath class defect for LLA format URL
* 3496349 2012-03-02 blaschke-oss JSR48 1.0.0: add CIMObjectPath getKeyValue
+ * 3510090 2012-03-23 blaschke-oss Fix CIMObjectPath.toString() inconsistencies
*/
package org.sblim.cimclient.unittest.cim;
@@ -139,6 +140,86 @@
verify("XmlSchemaName differs", xmlSchemaName.equals(cop.getXmlSchemaName()));
}
+ // These COPs are examples from DSP0004, DSP0207, etc. with slight
+ // modifications to match the client's functionality, i.e. true instead of
+ // True, 42 instead of 0x2A, 'A' instead of '\x41', sorted keys, etc.
+ //
+ // NOTE: UNTYPEDPATH_A AND TYPEDPATH_A ENTRIES MUST MATCH UP!!! In other
+ // words, they must be identical except for presence/absence of typing.
+ private static final String[] UNTYPEDPATH_A = {
+ "http://myserver.acme.com/root/cimv2:ACME_LogicalDisk.Drive=\"C\",SystemName=\"acme\"",
+ "//myserver.acme.com:5988/root/cimv2:ACME_BooleanKeyClass.KeyProp=true",
+ "/root/cimv2:ACME_IntegerKeyClass.KeyProp=42",
+ "ACME_CharKeyClass.KeyProp='A'",
+ "http://myserver.org:5066/root/cimv2:My_ComputerSystem.CreationClassName=\"My_ComputerSystem\",Name=\"mycmp\"",
+ "http://myserver.org/root/cimv2:My_ComputerSystem.CreationClassName=\"My_ComputerSystem\",Name=\"mycmp\"",
+ "//myserver.org/root/cimv2:My_ComputerSystem", "/root/cimv2:My_ComputerSystem",
+ "//www.acme.com/root/cimv2", "//www.acme.com/root/cimv2:CIM_RegisteredProfile",
+ "https://jdd:te...@ac...:5959/cimv2:CIM_RegisteredProfile",
+ "https://jdd:te...@ac...:5959/cimv2:CIM_RegisteredProfile.InstanceID=\"acme:1\"" };
+
+ private static final String[] TYPEDPATH_A = {
+ "http://myserver.acme.com/root/cimv2/(instance)ACME_LogicalDisk.Drive=(string)\"C\",SystemName=(string)\"acme\"",
+ "//myserver.acme.com:5988/root/cimv2/(instance)ACME_BooleanKeyClass.KeyProp=(boolean)true",
+ "/root/cimv2/(instance)ACME_IntegerKeyClass.KeyProp=(uint8)42",
+ "/(instance)ACME_CharKeyClass.KeyProp=(char16)'A'",
+ "http://myserver.org:5066/root/cimv2/(instance)My_ComputerSystem.CreationClassName=(string)\"My_ComputerSystem\",Name=(string)\"mycmp\"",
+ "http://myserver.org/root/cimv2/(instance)My_ComputerSystem.CreationClassName=(string)\"My_ComputerSystem\",Name=(string)\"mycmp\"",
+ "//myserver.org/root/cimv2/(class)My_ComputerSystem",
+ "/root/cimv2/(class)My_ComputerSystem",
+ "//www.acme.com/root/cimv2/(namespace)",
+ "//www.acme.com/root/cimv2/(class)CIM_RegisteredProfile",
+ "https://jdd:te...@ac...:5959/cimv2/(class)CIM_RegisteredProfile",
+ "https://jdd:te...@ac...:5959/cimv2/(instance)CIM_RegisteredProfile.InstanceID=(string)\"acme:1\"" };
+
+ /**
+ * Tests the toString method and MOF.objectHandle to make sure that what
+ * goes in matches what comes out.
+ */
+ public void testObjectPaths() {
+ String inStr, outStr;
+ CIMObjectPath cop;
+
+ verify("Untyped/typed arrays differ in size", UNTYPEDPATH_A.length == TYPEDPATH_A.length);
+
+ for (int i = 0; i < UNTYPEDPATH_A.length; i++) {
+ inStr = UNTYPEDPATH_A[i];
+ cop = new CIMObjectPath(inStr);
+ outStr = MOF.objectHandle(cop, false, false);
+ verify("Untyped in/out differs: " + inStr + " != " + outStr, inStr.equals(outStr));
+ }
+
+ for (int i = 0; i < TYPEDPATH_A.length; i++) {
+ inStr = TYPEDPATH_A[i];
+ cop = new CIMObjectPath(inStr);
+ outStr = MOF.objectHandle(cop, true, false);
+ verify("Typed in/out differs: " + inStr + " != " + outStr, inStr.equals(outStr));
+ }
+
+ for (int i = 0; i < UNTYPEDPATH_A.length; i++) {
+ inStr = UNTYPEDPATH_A[i];
+ cop = new CIMObjectPath(inStr);
+ outStr = MOF.objectHandle(cop, true, false);
+ verify("Untyped in/typed out differs: " + inStr + " != " + outStr, TYPEDPATH_A[i]
+ .equals(outStr));
+ }
+
+ for (int i = 0; i < TYPEDPATH_A.length; i++) {
+ inStr = TYPEDPATH_A[i];
+ cop = new CIMObjectPath(inStr);
+ outStr = MOF.objectHandle(cop, false, false);
+ verify("Typed in/untyped out differs: " + inStr + " != " + outStr, UNTYPEDPATH_A[i]
+ .equals(outStr));
+ }
+
+ for (int i = 0; i < UNTYPEDPATH_A.length; i++) {
+ inStr = UNTYPEDPATH_A[i];
+ cop = new CIMObjectPath(inStr);
+ outStr = cop.toString();
+ verify("Untyped in/toString differs: " + inStr + " != " + outStr, inStr.equals(outStr));
+ }
+ }
+
private CIMProperty<String> createProperty1a() {
return new CIMProperty<String>("Name", CIMDataType.STRING_T, "A name", true, true,
"MyClass");
|