(file) Return to TestSLPClient.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Providers / slp

  1 martin 1.10 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.11 //
  3 martin 1.10 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.11 //
 10 martin 1.10 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.11 //
 17 martin 1.10 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.11 //
 20 martin 1.10 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.11 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.10 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.11 //
 28 martin 1.10 //////////////////////////////////////////////////////////////////////////
 29 mday   1.1  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #include <Pegasus/Common/Config.h>
 33 jim.wunderlich 1.7  #include <Pegasus/Common/PegasusAssert.h>
 34 thilo.boehm    1.13 #include <Pegasus/Common/CIMName.h>
 35                     
 36                     #include <Pegasus/General/OptionManager.h>
 37                     
 38 mday           1.1  #include <Pegasus/Client/CIMClient.h>
 39                     
 40                     PEGASUS_USING_PEGASUS;
 41                     PEGASUS_USING_STD;
 42                     
 43                     const CIMNamespaceName NAMESPACE = CIMNamespaceName ("root/cimv2");
 44                     
 45                     
 46                     int main(int argc, char** argv)
 47                     {
 48                         try
 49                         {
 50                             CIMClient client;
 51                             client.connect("localhost", 5988, String::EMPTY, String::EMPTY);
 52 kumpf          1.12 
 53 mday           1.1          Array<CIMInstance> ia;
 54                             try
 55                             {
 56 marek          1.9            ia = client.enumerateInstances(
 57                                        NAMESPACE,
 58                                        CIMName("PG_WBEMSLPTemplate"));
 59 mday           1.1          }
 60                             catch (Exception& e)
 61                             {
 62                                cout<<e.getMessage()<<endl;
 63                             }
 64                     
 65                           // There should be one instance
 66                            if (ia.size() == 0)
 67                            {
 68                              cout << "+++++ Error: enumerateInstances on WBEMSLPTemplate" << endl;
 69                              cout << "+++++ Test failed" << endl;
 70                              return 1;
 71                            }
 72                            else
 73                            {
 74 kumpf          1.12 
 75 marek          1.9         Array<CIMObjectPath> instanceNames = client.enumerateInstanceNames(
 76                                                                     NAMESPACE,
 77                                                                     CIMName("CIM_WBEMSLPTemplate"));
 78 mday           1.1  
 79 kumpf          1.12 
 80 mday           1.1  
 81                            for (Uint32 i = 0; i < instanceNames.size(); i++)
 82                            {
 83                               CIMInstance i1 = client.getInstance(NAMESPACE,instanceNames[i]);
 84                               Uint32 NumProperties;
 85 marek          1.9            cout << "Getting all properties for WBEMSLPTemplate instance .....  "
 86                                    << i+1 <<"\n";
 87 mday           1.1  
 88                               NumProperties = i1.getPropertyCount();
 89                               for(Uint32 i=0;i<NumProperties;i++)
 90                               {
 91                                 CIMProperty p1=i1.getProperty(i);
 92                                 CIMValue v1=p1.getValue();
 93                                 CIMName n1=p1.getName();
 94 marek          1.9              cout << n1.getString() << " is "  << v1.toString() << "\n";
 95 mday           1.1            }
 96                           }
 97                           }
 98                         }
 99                         catch(Exception& e)
100                         {
101                            PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
102                            exit(1);
103                         }
104                     
105                          cout << "Client Execution finished"<< endl;
106                          return 0;
107                     }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2