-#include <cassert>
-#include <cstdlib>
-#include <iostream>
-#include <Pegasus/Common/CIMReference.h>
-#include <Pegasus/Common/XmlWriter.h>
-
-PEGASUS_USING_PEGASUS;
-PEGASUS_USING_STD;
-//#define DDD(X) // X
-#define DDD(X) X
-void test01()
-{
- {
- String on1;
- on1 = "//atp:77/root/cimv25:TennisPlayer.last=\"Rafter\",first=\"Patrick\"";
-
- String on2;
- on2 = "//atp:77/root/cimv25:TennisPlayer.first=\"Patrick\",last=\"Rafter\"";
-
- CIMReference r = on1;
- assert(r.toString() != on1);
- assert(r.toString() == on2);
- }
-
- {
- CIMReference r1 = "MyClass.z=true,y=1234,x=\"Hello World\"";
- CIMReference r2 = "myclass.X=\"Hello World\",Z=true,Y=1234";
- CIMReference r3 = "myclass.X=\"Hello\",Z=true,Y=1234";
- // cout << r1.toString() << endl;
- // cout << r2.toString() << endl;
- assert(r1 == r2);
- assert(r1 != r3);
- }
-
- // Test case independence and order independence of parameters.
- {
- CIMReference r1 = "X.a=123,b=true";
- CIMReference r2 = "x.B=TRUE,A=123";
- assert(r1 == r2);
- assert(r1.makeHashCode() == r2.makeHashCode());
-
- CIMReference r3 = "x.B=TRUE,A=123,c=FALSE";
- assert(r1 != r3);
- }
-
-
- // Test building from component parts of CIM Reference.
- {
- CIMReference r1 ("atp:77", "root/cimv25", "TennisPlayer");
- CIMReference r2 ("//atp:77/root/cimv25:TennisPlayer.");
- //cout << "r1 " << r1.toString() << endl;
- //cout << "r2 " << r2.toString() << endl;
- assert(r1 == r2);
- assert(r1.toString() == r2.toString());
-
- }
-
-
- {
- String hostName = "atp:77";
- String nameSpace = "root/cimv2";
- String className = "tennisplayer";
-
- CIMReference r1;
- r1.setHost(hostName);
-
-
- // ATTN: Mike. Think there is an error here in the CIMreerence
- // code. It applies the classname legal test to the namespace.
- // However, the namespace may have / in the namespace legally.
- //DDD(cout << "test4a1" << endl;)
- //r1.setNameSpace(nameSpace);
- //DDD(cout << "test4a2" << endl;)
-
- r1.setClassName(className);
- String newHostName = r1.getHost();
- //cout << "HostName = " << newHostName << endl;
-
-
- CIMReference r2 (hostName, nameSpace, className);
- // Dropped for the moment because of the hostname problem.
- //assert(r1 == r2);
-
- }
-
-
-}
-
-int main()
-{
- try
- {
- test01();
-
- cout << "+++++ passed all tests" << endl;
- }
- catch (Exception& e)
- {
- cerr << e.getMessage() << endl;
- exit(1);
- }
- return 0;
-}
+//%/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining a copy\r
+// of this software and associated documentation files (the "Software"), to \r
+// deal in the Software without restriction, including without limitation the \r
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or \r
+// sell copies of the Software, and to permit persons to whom the Software is\r
+// furnished to do so, subject to the following conditions:\r
+// \r
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN \r
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED\r
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT\r
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \r
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN \r
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+//==============================================================================\r
+#include <cassert>\r
+#include <cstdlib>\r
+#include <iostream>\r
+#include <Pegasus/Common/CIMReference.h>\r
+#include <Pegasus/Common/XmlWriter.h>\r
+\r
+PEGASUS_USING_PEGASUS;\r
+PEGASUS_USING_STD;\r
+//#define DDD(X) // X\r
+#define DDD(X) X\r
+void test01()\r
+{\r
+ {\r
+ String on1;\r
+ on1 = "//atp:77/root/cimv25:TennisPlayer.last=\"Rafter\",first=\"Patrick\"";\r
+\r
+ String on2;\r
+ on2 = "//atp:77/root/cimv25:TennisPlayer.first=\"Patrick\",last=\"Rafter\"";\r
+\r
+ CIMReference r = on1;\r
+ assert(r.toString() != on1);\r
+ assert(r.toString() == on2);\r
+ }\r
+\r
+ {\r
+ CIMReference r1 = "MyClass.z=true,y=1234,x=\"Hello World\"";\r
+ CIMReference r2 = "myclass.X=\"Hello World\",Z=true,Y=1234";\r
+ CIMReference r3 = "myclass.X=\"Hello\",Z=true,Y=1234";\r
+ // cout << r1.toString() << endl;\r
+ // cout << r2.toString() << endl;\r
+ assert(r1 == r2);\r
+ assert(r1 != r3);\r
+ }\r
+\r
+ // Test case independence and order independence of parameters.\r
+ {\r
+ CIMReference r1 = "X.a=123,b=true";\r
+ CIMReference r2 = "x.B=TRUE,A=123";\r
+ assert(r1 == r2);\r
+ assert(r1.makeHashCode() == r2.makeHashCode());\r
+\r
+ CIMReference r3 = "x.B=TRUE,A=123,c=FALSE";\r
+ assert(r1 != r3);\r
+ }\r
+\r
+\r
+ // Test building from component parts of CIM Reference.\r
+ {\r
+ CIMReference r1 ("atp:77", "root/cimv25", "TennisPlayer");\r
+ CIMReference r2 ("//atp:77/root/cimv25:TennisPlayer.");\r
+ //cout << "r1 " << r1.toString() << endl;\r
+ //cout << "r2 " << r2.toString() << endl;\r
+ assert(r1 == r2);\r
+ assert(r1.toString() == r2.toString());\r
+\r
+ }\r
+\r
+\r
+ {\r
+ String hostName = "atp:77";\r
+ String nameSpace = "root/cimv2";\r
+ String className = "tennisplayer";\r
+\r
+ CIMReference r1;\r
+ r1.setHost(hostName);\r
+\r
+\r
+ // ATTN: Mike. Think there is an error here in the CIMreerence\r
+ // code. It applies the classname legal test to the namespace.\r
+ // However, the namespace may have / in the namespace legally.\r
+ //DDD(cout << "test4a1" << endl;)\r
+ //r1.setNameSpace(nameSpace);\r
+ //DDD(cout << "test4a2" << endl;)\r
+\r
+ r1.setClassName(className);\r
+ String newHostName = r1.getHost();\r
+ //cout << "HostName = " << newHostName << endl;\r
+\r
+\r
+ CIMReference r2 (hostName, nameSpace, className);\r
+ // Dropped for the moment because of the hostname problem.\r
+ //assert(r1 == r2);\r
+\r
+ }\r
+\r
+\r
+}\r
+\r
+int main()\r
+{\r
+ try\r
+ {\r
+ test01();\r
+\r
+ cout << "+++++ passed all tests" << endl;\r
+ }\r
+ catch (Exception& e)\r
+ {\r
+ cerr << e.getMessage() << endl;\r
+ exit(1);\r
+ }\r
+ return 0;\r
+}\r