BUG#: 8730 master origin RELEASE_2_10_0-RC1
authorkarl <karl>
Thu, 18 Feb 2010 18:01:29 +0000 (18:01 +0000)
committerkarl <karl>
Thu, 18 Feb 2010 18:01:29 +0000 (18:01 +0000)
TITLE: Clean up and add test for execQuery

DESCRIPTION: Clean up argument processing of the xq operation, correct
documentation for this function, and add a test in the cimcli test
Makefile.

src/Clients/cimcli/CIMCLIClient.cpp
src/Clients/cimcli/CIMCLIClient.h
src/Clients/cimcli/CIMCLICommand.cpp
src/Clients/cimcli/CIMCLIOperations.cpp
src/Clients/cimcli/CIMCLIOptions.cpp
src/Clients/cimcli/doc/cimcli.nroff
src/Pegasus/msg/CLI/pegasusCLI_en.txt
src/Providers/TestProviders/CLITestProvider/tests/Makefile
src/Providers/TestProviders/CLITestProvider/tests/helpresult.master
src/Providers/TestProviders/CLITestProvider/tests/helpresult.master.ssl
src/Providers/TestProviders/CLITestProvider/tests/result.master

index eec2e7fab7da44679d7f0aa2fd8c4fdf7a659f06..a94647c393706321f915a1457510d3efed644954 100644 (file)
@@ -766,7 +766,7 @@ int enumerateInstances(Options& opts)
     Execute the client ExecQuery function. The parameters are:
     namespace, queryLanguage, and the query string
 */
-int executeQuery(Options& opts)
+int execQuery(Options& opts)
 {
     if (opts.verboseTest)
     {
index 5dbc058615e80c6c086876e49226f9cc11e29020..3bf566401c41e6b68d52db9d43e203f0633925dc 100644 (file)
@@ -125,7 +125,7 @@ int PEGASUS_CLI_LINKAGE associatorNames(Options& opts);
 
 int PEGASUS_CLI_LINKAGE invokeMethod(Options& opts);
 
-int PEGASUS_CLI_LINKAGE executeQuery(Options& opts);
+int PEGASUS_CLI_LINKAGE execQuery(Options& opts);
 
 int PEGASUS_CLI_LINKAGE enumerateNamespaceNames(Options& opts);
 
index 48550922f2fd968f7e7e2d5d38db46622caa5852..417cd0de6982879041a8f855ce749c087875b8c3 100644 (file)
@@ -837,12 +837,23 @@ int main(int argc, char** argv)
                     break;
 
                 case ID_ExecQuery:
+                    if (argc <= 2 && opts.query.size() == 0)
+                    {
+                        cerr << "ERROR: ExecQuery requires a query"
+                                "filter definition\n"
+                                "   - supplied directly as a parameter\n"
+                                "   - OR supplied with the -f option\n"
+                                "   The filterLanguage may be supplied\n"
+                                "   - as the second argument\n"
+                                "   - OR as the -ql option\n"
+                              << endl;
+                    }
                     opts.query = argv[2];
                     if (argc==4)
                     {
                         opts.queryLanguage = argv[3];
                     }
-                    opts.termCondition = executeQuery(opts);
+                    opts.termCondition = execQuery(opts);
                     break;
 
                 case ID_StatisticsOn:
index 40a7fc12231ef59e8f989bd566a5bdbe0b843f49..5fb0f8e1e484341bcdc7f2ff231d8b23930195d4 100644 (file)
@@ -151,7 +151,7 @@ OPERATION_TABLE_ENTRY OperationTable[] =
 
     {ID_ExecQuery,               "execQuery",     2 ,       "xq",
     "Clients.cimcli.CIMCLIClient.XQ_COMMAND_HELP",
-    " Execute Query <query-expresssion> [<query-language>]"},
+    " ExecQuery <query-expresssion> [<query-language>]"},
 
     {ID_EnumerateNamespaces,     "enumerateNamespaces",2 ,  "ns",
     "Clients.cimcli.CIMCLIClient.NS_COMMAND_HELP",
index 0bc1c0a4f43c684f3d1284ef0995ecd8ca915d9e..7dbb89b3f283dc248151cc99d7958feaa39e16ac 100644 (file)
@@ -214,6 +214,10 @@ void BuildOptionsTable(
         "Clients.cimcli.CIMCLIClient.FILTER_OPTION_HELP",
         "Defines a filter to use for query. Single String input"},
 
+        {"queryLanguage", "WQL", false, Option::STRING, 0, 0, "ql",
+        "Clients.cimcli.CIMCLIClient.QUERYLANGUAGE_OPTION_HELP",
+        "Defines a Query Language to be used with a query filter.\n"},
+
         // KS change the output formats to use the enum options function
         // Deprecate this function.
         {"outputformats", "mof", false, Option::STRING, 0,NUM_OUTPUTFORMATS,
@@ -654,6 +658,10 @@ int CheckCommonOptionValues(OptionManager& om, char** argv, Options& opts)
                                    opts.setRtnHostNames,
                                    opts.rtnHostSubstituteName);
 
+    lookupStringOption(opts, om, "filter", opts.query);
+
+    lookupStringOption(opts, om, "queryLanguage", opts.queryLanguage);
+
     // Test for existence of input parameter option.  If found, put out
     // warning and exit with syntax error message.  This parameter was
     // deprecated and removed in favor of direct input of name/value pairs
index 672ced18d6acb9b46fd12f243b96ed83661f5f4f..6a383e7c8f03511c8efd0313869d8797edb398d2 100644 (file)
@@ -438,7 +438,7 @@ created instance in the following format:
 The detailed form for value input is defined as follows:
 
 .B 1.
-Scalar property values - The tring form of the property similar
+Scalar property values - The string form of the property similar
 to MOF input of constant values is used to input scalar values.
 The scalarvalue input includes all CIM Types. Numeric values may
 be input in hex, octal, decimal or binary in the same form as
index bdb2416bd9fbcdc71546ab3d364b7493cde540e7..34a16d8d41a41c6c516d5a8456ad27626f7a7f08 100755 (executable)
@@ -1353,6 +1353,9 @@ en:table {
         Clients.cimcli.CIMCLIClient.FILTER_OPTION_HELP:string {
         "-f  filter. Defines a filter to use for query. Single String input. Default()\n"}
 
+        Clients.cimcli.CIMCLIClient.QUERYLANGUAGE_OPTION_HELP:string {
+        "-ql  queryLanguage. Defines a Query Language to be used with a query filter. Default(WQL)\n"}
+
         Clients.cimcli.CIMCLIClient.OUTPUTFORMATS_OPTION_HELP:string {
         "-o  outputformats. Output in xml, mof, txt. Default(mof)\n"}
 
index 8d542cb44657d6465209f0a129d57fa51e9c4503..5ec9be941153c6a59e4c483424a2d879ed488a46 100644 (file)
@@ -690,6 +690,19 @@ enumerateClasses:
 
        @$(ECHO) 22. +++++ Test enumerateClasses
 
+## Test executeQuery Operation. This test should 
+## return a single instance.  We just test the response count to avoid
+## the issue of variable information in the result file
+testExecQuery:
+       @$(ECHO) 23. +++++ Test For execQuery
+       @$(ECHO) 23. +++++ Test For execQuery  >> $(RESULTFILE)
+ifdef PEGASUS_ENABLE_EXECQUERY
+       @cimcli xq "Select scaleBool from Test_CLITestProviderClass" \
+         -n "$(PROVIDERNS)" -count 1
+endif
+
+       @$(ECHO) 23. +++++ Test enumerateClasses
+
 ### Execute the set of test targets defined below
 poststarttests:
 ##      Remove existing master files
@@ -722,6 +735,7 @@ poststarttests:
        $(MAKE) objectcountertests
        $(MAKE) SortInstancesTest
        $(MAKE) enumerateClasses
+       $(MAKE) testExecQuery
 
        @$(ECHO) +++++ Compare Result files
 ##      diffsort used because there is at least one instance where
index 16444a6d8d7a8ffd7995a21b2efe3f117fe8f26f..4114abb2ad47e03b129d335ff465de417ce46977 100644 (file)
@@ -48,6 +48,8 @@ This command executes single CIM Operations.
     the same name/value pair syntax as properties in create
     and modify instance.. Default()
  -f  filter. Defines a filter to use for query. Single String input. Default()
+ -ql  queryLanguage. Defines a Query Language to be used with a query filter.
+. Default(WQL)
  -o  outputformats. Output in xml, mof, txt, table. Default(mof)
  -x  xmlOutput. Output objects in xml format. Default(false)
  --version  version. Displays software Version. Default(false)
@@ -116,7 +118,7 @@ rn    referenceNames        Enumerate Reference Names <classname> |
                             <instancename>
 im    invokeMethod          Invoke Method for <object> <method>
                             {<inputParams>}
-xq    execQuery              Execute Query <query-expresssion>
+xq    execQuery              ExecQuery <query-expresssion>
                             [<query-language>]
 ns    enumerateNamespaces   Enumerate all namespaces on the server.
 son   Turn On Statistics    Turn on CIM Server Statistics Gathering
@@ -301,7 +303,7 @@ rn    referenceNames        Enumerate Reference Names <classname> |
                             <instancename>
 im    invokeMethod          Invoke Method for <object> <method>
                             {<inputParams>}
-xq    execQuery              Execute Query <query-expresssion>
+xq    execQuery              ExecQuery <query-expresssion>
                             [<query-language>]
 ns    enumerateNamespaces   Enumerate all namespaces on the server.
 son   Turn On Statistics    Turn on CIM Server Statistics Gathering
@@ -349,6 +351,8 @@ This command executes single CIM Operations.
     the same name/value pair syntax as properties in create
     and modify instance.. Default()
  -f  filter. Defines a filter to use for query. Single String input. Default()
+ -ql  queryLanguage. Defines a Query Language to be used with a query filter.
+. Default(WQL)
  -o  outputformats. Output in xml, mof, txt, table. Default(mof)
  -x  xmlOutput. Output objects in xml format. Default(false)
  --version  version. Displays software Version. Default(false)
index c14dca0c7643d458de9b091d63d75bc45bbf6af1..d5089c26d4b16aa7af3cc20134b5bd4d97911551 100644 (file)
@@ -55,6 +55,8 @@ This command executes single CIM Operations.
     the same name/value pair syntax as properties in create
     and modify instance.. Default()
  -f  filter. Defines a filter to use for query. Single String input. Default()
+ -ql  queryLanguage. Defines a Query Language to be used with a query filter.
+. Default(WQL)
  -o  outputformats. Output in xml, mof, txt, table. Default(mof)
  -x  xmlOutput. Output objects in xml format. Default(false)
  --version  version. Displays software Version. Default(false)
@@ -123,7 +125,7 @@ rn    referenceNames        Enumerate Reference Names <classname> |
                             <instancename>
 im    invokeMethod          Invoke Method for <object> <method>
                             {<inputParams>}
-xq    execQuery              Execute Query <query-expresssion>
+xq    execQuery              ExecQuery <query-expresssion>
                             [<query-language>]
 ns    enumerateNamespaces   Enumerate all namespaces on the server.
 son   Turn On Statistics    Turn on CIM Server Statistics Gathering
@@ -308,7 +310,7 @@ rn    referenceNames        Enumerate Reference Names <classname> |
                             <instancename>
 im    invokeMethod          Invoke Method for <object> <method>
                             {<inputParams>}
-xq    execQuery              Execute Query <query-expresssion>
+xq    execQuery              ExecQuery <query-expresssion>
                             [<query-language>]
 ns    enumerateNamespaces   Enumerate all namespaces on the server.
 son   Turn On Statistics    Turn on CIM Server Statistics Gathering
@@ -363,6 +365,8 @@ This command executes single CIM Operations.
     the same name/value pair syntax as properties in create
     and modify instance.. Default()
  -f  filter. Defines a filter to use for query. Single String input. Default()
+ -ql  queryLanguage. Defines a Query Language to be used with a query filter.
+. Default(WQL)
  -o  outputformats. Output in xml, mof, txt, table. Default(mof)
  -x  xmlOutput. Output objects in xml format. Default(false)
  --version  version. Displays software Version. Default(false)
index 2a62d24b877fce8d27eae3338e3bddf1583b3c62..3ac6e7d0e5b232e87e164598dc22ddb6db971929 100644 (file)
@@ -1345,3 +1345,4 @@ WET_RelatedStatistics
 WET_SettingContext
 WET_Statistics
 WET_Synchronized
+23. +++++ Test For execQuery