From: Chris B. <buc...@us...> - 2012-06-20 18:47:20
|
Update of /cvsroot/sblim/sfcb/test/TestProviders In directory vz-cvs-3.sog:/tmp/cvs-serv5229/test/TestProviders Modified Files: cmpiTestIndicationProvider.c Log Message: test case for [ 3532494 ] interopProvider not honoring SourceNamespaces[] correctly Index: cmpiTestIndicationProvider.c =================================================================== RCS file: /cvsroot/sblim/sfcb/test/TestProviders/cmpiTestIndicationProvider.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cmpiTestIndicationProvider.c 13 Feb 2012 23:10:20 -0000 1.3 +++ cmpiTestIndicationProvider.c 20 Jun 2012 18:47:18 -0000 1.4 @@ -14,6 +14,8 @@ unsigned char CMPI_false = 0; static int enabled = 0; +static int activated = 0; +static int activated2 = 0; static int _nextUID = 0; @@ -28,7 +30,7 @@ CMPIStatus rc; char buffer[32]; - if (enabled) + if (enabled && activated) { cop = CMNewObjectPath (broker, "root/interop", @@ -55,6 +57,45 @@ fprintf (stderr, "+++ generateIndication() done\n"); } +static void +generateIndication2 (const char *methodname, const CMPIContext * ctx) +{ + + CMPIInstance *inst; + CMPIObjectPath *cop; + CMPIDateTime *dat; + CMPIArray *ar; + CMPIStatus rc; + char buffer[32]; + + if (enabled && activated2) + { + cop = + CMNewObjectPath (broker, "root/interop2", + "Test_Indication", &rc); + inst = CMNewInstance (broker, cop, &rc); + + sprintf (buffer, "%d", _nextUID++); + CMSetProperty (inst, "IndicationIdentifier", buffer, CMPI_chars); + + dat = CMNewDateTime (broker, &rc); + CMSetProperty (inst, "IndicationTime", &dat, CMPI_dateTime); + + CMSetProperty (inst, "MethodName", methodname, CMPI_chars); + + ar = CMNewArray (broker, 0, CMPI_string, &rc); + CMSetProperty (inst, "CorrelatedIndications", &ar, CMPI_stringA); + + rc = CBDeliverIndication (broker, ctx, "root/interop", inst); + if (rc.rc != CMPI_RC_OK) + { + fprintf (stderr, "+++ Could not send the indication!\n"); + } + } + fprintf (stderr, "+++ generateIndication() done\n"); +} + + //---------------------------------------------------------- //--- // Method Provider @@ -84,6 +125,7 @@ else { generateIndication (method, ctx); + generateIndication2(method, ctx); } value.uint32 = 0; @@ -129,7 +171,14 @@ const CMPISelectExp * exp, const char *clsName, const CMPIObjectPath * classPath, CMPIBoolean firstActivation) { - fprintf (stderr, "+++ indProvActivateFilter()\n"); + char* op = CMGetCharPtr(CMObjectPathToString(classPath, NULL)); + fprintf (stderr, "+++ indProvActivateFilter() for %s\n", op); + + if (strcmp(op, "root/interop:Test_Indication") == 0) + activated = 1; + else if (strcmp(op, "root/interop2:Test_Indication") == 0) + activated2 = 1; + CMReturn (CMPI_RC_OK); } @@ -138,7 +187,14 @@ const CMPISelectExp * filter, const char *clsName, const CMPIObjectPath * classPath, CMPIBoolean lastActivation) { - fprintf (stderr, "+++ indProvDeActivateFilter\n"); + char* op = CMGetCharPtr(CMObjectPathToString(classPath, NULL)); + fprintf (stderr, "+++ indProvDeActivateFilter for %s\n", op); + + if (strcmp(op, "root/interop:Test_Indication") == 0) + activated = 0; + else if (strcmp(op, "root/interop2:Test_Indication") == 0) + activated2 = 0; + CMReturn (CMPI_RC_OK); } |