axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r1124367 - in /axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp: AxisBenchClient.cpp CommonClientTestCode.hpp InteropTestRound1Client.cpp XSDElementClient.cpp XSDElementNilClient.cpp XSD_dateTimeClient.cpp XSD_timeClient.cpp
Date Wed, 18 May 2011 18:26:35 GMT
Author: nadiramra
Date: Wed May 18 18:26:34 2011
New Revision: 1124367

URL: http://svn.apache.org/viewvc?rev=1124367&view=rev
Log:
Minor - Test cases should take into account daylight saving time

Modified:
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_dateTimeClient.cpp
    axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp Wed May 18
18:26:34 2011
@@ -212,7 +212,8 @@ int main( int argc, char * argv[])
                         cout << " IntegerType " << outArray[i]->IntegerType
<< endl;
                         cout << " DoubleType " << outArray[i]->DoubleType
<< endl;
                         cout << " BooleanType " << outArray[i]->BooleanType
<< endl;
-                        strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", &outArray[i]->DateTimeType);
+
+                        strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&outArray[i]->DateTimeType));
                         cout << " DateTimeType " << dateTime << endl;
                         strftime(dateTime, 50, "%a %b %d %Y", &outArray[i]->DateType);
                         cout << " DateType " << dateTime << endl;

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp Wed
May 18 18:26:34 2011
@@ -1,6 +1,11 @@
 #ifndef __COMMONHEADERFILE
 #define __COMMONHEADERFILE
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+
 // Prototype
 bool parse_args(int *argc, char *argv[], char **endpoint);
 void shift_args_up(int i, int *argc, char *argv[]);
@@ -230,4 +235,67 @@ void shift_args_up(int i, int *argc, cha
     *argc-=2;
 }
 
-#endif
\ No newline at end of file
+// Following functions adjust the tm structure by taking in consideration
+// daylight saving time...so that when we spit out the results it will
+// match what is expected (which is not with daylight saving time)
+
+bool isDSTInEffect()
+{
+    time_t currentTime;
+    struct tm *ts;
+
+    (void)time(&currentTime);
+    ts = localtime(&currentTime);
+
+    if (ts->tm_isdst > 0)
+        return true;
+
+    return false;
+}
+
+struct tm * adjustTimeStruct(struct tm *t)
+{
+
+
+    if (0)
+    {
+      printf("tm_hour:  %d\n",t->tm_hour);
+      printf("tm_min:  %d\n",t->tm_min);
+      printf("tm_sec:  %d\n",t->tm_sec);
+      printf("tm_mon:  %d\n",t->tm_mon);
+      printf("tm_mday:  %d\n",t->tm_mday);
+      printf("tm_year:  %d\n",t->tm_year);
+      printf("tm_yday:  %d\n",t->tm_yday);
+      printf("tm_wday:  %d\n",t->tm_wday);
+      printf("tm_isdst:  %d\n",t->tm_isdst);
+    }
+
+    if (isDSTInEffect())
+    {
+        --(t->tm_hour);
+
+       if (t->tm_hour < 0)
+            mktime (t);
+    }
+
+    if (0)
+    {
+     printf("===After\n");
+
+     printf("tm_hour:  %d\n",t->tm_hour);
+     printf("tm_min:  %d\n",t->tm_min);
+     printf("tm_sec:  %d\n",t->tm_sec);
+     printf("tm_mon:  %d\n",t->tm_mon);
+     printf("tm_mday:  %d\n",t->tm_mday);
+     printf("tm_year:  %d\n",t->tm_year);
+     printf("tm_yday:  %d\n",t->tm_yday);
+     printf("tm_wday:  %d\n",t->tm_wday);
+     printf("tm_isdst:  %d\n",t->tm_isdst);
+    }
+
+    return t;
+}
+
+
+
+#endif

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp Wed
May 18 18:26:34 2011
@@ -334,37 +334,34 @@ int main( int argc, char * argv[])
 
                         xsd__dateTime   ed_temp = ws.echoDate( time);
                         
-                        // A simple memcmp of ed_temp and time will not work because
-                        // it does not take into account timezone, so we need to 
-                        // compare results of asctime()
-                        char ExpectedTime[1024];
-                        char ReturnedTime[1024];
-                        
-                        char *  pExpectedTime = asctime( &time );
-                        int      iETLength = (pExpectedTime != NULL) ? (int) strlen(pExpectedTime)
: 0;
-                        if (iETLength > 0)
-                                strcpy(ExpectedTime, pExpectedTime);
-                        
-                        char *  pReturnedTime = asctime( &ed_temp );
-                        int             iRTLength = (pReturnedTime != NULL) ? (int) strlen(pReturnedTime)
: 0;
-                        if( iRTLength > 0)
-                                strcpy(ReturnedTime, pReturnedTime);
-
-                        if( iETLength > 0 && 
-                                iRTLength > 0 &&
-                                strcmp(ExpectedTime, ReturnedTime) == 0)
+                        adjustTimeStruct(&ed_temp);
+
+                        if( memcmp(&time, &ed_temp, sizeof(struct tm)) == 0)
                         {
                                 cout << "successful" << endl;
                         }
                         else
                         {
-                                if( iETLength == 0)
-                                        strcpy(ExpectedTime,"NULL");
+                            char ExpectedTime[1024];
+                            char ReturnedTime[1024];
+
+                            char *  pExpectedTime = asctime( &time );
+                            int      iETLength = (pExpectedTime != NULL) ? (int) strlen(pExpectedTime)
: 0;
+                            if (iETLength > 0)
+                                    strcpy(ExpectedTime, pExpectedTime);
+
+                            char *  pReturnedTime = asctime( &ed_temp );
+                            int             iRTLength = (pReturnedTime != NULL) ? (int) strlen(pReturnedTime)
: 0;
+                            if( iRTLength > 0)
+                                    strcpy(ReturnedTime, pReturnedTime);
+
+                            if( iETLength == 0)
+                                    strcpy(ExpectedTime,"NULL");
+
+                            if( iRTLength == 0)
+                                    strcpy(ReturnedTime,"NULL");
 
-                                if( iRTLength == 0)
-                                        strcpy(ReturnedTime,"NULL");
-        
-                                cout << "Failed.  The expected time (" << ExpectedTime
<< ") was not the same as the returned time (" << ReturnedTime << ")." <<
endl;
+                            cout << "Failed.  The expected time (" << ExpectedTime
<< ") was not the same as the returned time (" << ReturnedTime << ")." <<
endl;
                         }
 
         //testing echo hex binary

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp Wed May
18 18:26:34 2011
@@ -155,7 +155,7 @@ int main(int argc, char* argv[])
                 cout << "date=" << dateTime << endl;
 
                 dateTimeResult = ws->setGetDateTimeType(testDate);
-                strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", &dateTimeResult);
+                strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&dateTimeResult));
                 cout << "dateTime=" << dateTime << endl;
 
 //  This is being commented out due to issue on some servers

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp Wed May
18 18:26:34 2011
@@ -230,7 +230,7 @@ int main(int argc, char* argv[])
                         cout << "date nil=NULL" << endl;
 
                 dateTimeResult = ws->setGetDateTimeType(&testDate);
-                strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", dateTimeResult);
+                strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(dateTimeResult));
                 cout << "dateTime=" << dateTime << endl;
                 dateTimeResult = ws->setGetDateTimeType(NULL);
                 if(dateTimeResult) {

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_dateTimeClient.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_dateTimeClient.cpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_dateTimeClient.cpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_dateTimeClient.cpp Wed May
18 18:26:34 2011
@@ -29,6 +29,8 @@
 #include <ctype.h>
 #include <iostream>
 
+#include "CommonClientTestCode.hpp"
+
 
 int main(int argc, char* argv[])
 {
@@ -60,14 +62,14 @@ int main(int argc, char* argv[])
 
         // Test non-nillable element
         result = ws->asNonNillableElement(input);
-        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", &result);
+        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&result));
         cout << "non-nillable element=" << returnString << endl;
 
         // Test nillable element, with a value
         nillableResult = ws->asNillableElement(&input);
         if (nillableResult)
         {
-            strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", nillableResult);
+            strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(nillableResult));
             cout << "nillable element=" << returnString << endl;
             delete nillableResult;
         }
@@ -78,7 +80,7 @@ int main(int argc, char* argv[])
         nillableResult = ws->asNillableElement(NULL);
         if (nillableResult)
         {
-            strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", nillableResult);
+            strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(nillableResult));
             cout << "nil element=" << returnString << endl;
             delete nillableResult;
         }
@@ -92,7 +94,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.setrequiredAttribute(input);
         requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
         result = requiredAttributeResult->getrequiredAttribute();
-        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", &result);
+        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&result));
         cout << "required attribute=" << returnString << endl;
         delete requiredAttributeResult;
 
@@ -144,7 +146,7 @@ int main(int argc, char* argv[])
         cout << "array of " << outputSize << " elements" << endl;
         for (i = 0; i < outputSize ; i++)
         {
-            strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", output[i]);
+            strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct((struct tm
*)output[i]));
             cout << "  element[" << i << "]=" << returnString <<
endl;
         }
         // Clear up input array
@@ -160,7 +162,7 @@ int main(int argc, char* argv[])
         complexTypeInput.setcomplexTypeElement(input);
         complexTypeResult = ws->asComplexType(&complexTypeInput);
         result = complexTypeResult->getcomplexTypeElement();
-        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", &result);
+        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&result));
         cout << "within complex type=" << returnString << endl;
         delete complexTypeResult;
 

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp?rev=1124367&r1=1124366&r2=1124367&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/cpp/XSD_timeClient.cpp Wed May 18
18:26:34 2011
@@ -28,6 +28,7 @@
 #include <ctype.h>
 #include <iostream>
 
+#include "CommonClientTestCode.hpp"
 
 int main(int argc, char* argv[])
 {
@@ -58,7 +59,7 @@ int main(int argc, char* argv[])
 
         // Test non-nillable element
         result = ws->asNonNillableElement(input);
-        strftime(returnString, 50, "%H:%M:%S", &result);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(&result));
         cout << "non-nillable element=" << returnString << endl;
 
         // Test nillable element, with a value
@@ -67,7 +68,7 @@ int main(int argc, char* argv[])
         nillableResult = ws->asNillableElement(nillableInput);
         if (nillableResult)
         {
-            strftime(returnString, 50, "%H:%M:%S", nillableResult);
+            strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(nillableResult));
             cout << "nillable element=" << returnString << endl;
             delete nillableResult;
         }
@@ -79,7 +80,7 @@ int main(int argc, char* argv[])
         nillableResult = ws->asNillableElement(NULL);
         if (nillableResult)
         {
-            strftime(returnString, 50, "%H:%M:%S", nillableResult);
+            strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(nillableResult));
             cout << "nil element=" << returnString << endl;
             delete nillableResult;
         }
@@ -91,7 +92,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.setrequiredAttribute(input);
         RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
         result = requiredAttributeResult->getrequiredAttribute();
-        strftime(returnString, 50, "%H:%M:%S", &result);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(&result));
         cout << "required attribute=" << returnString << endl;
         delete requiredAttributeResult;
 
@@ -142,7 +143,7 @@ int main(int argc, char* argv[])
         cout << "array of " << outputSize << " elements" << endl;
         for (i = 0; i < outputSize ; i++)
         {
-            strftime(returnString, 50, "%H:%M:%S", output[i]);
+            strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct((struct tm *)output[i]));
             cout << "  element[" << i << "]=" << returnString <<
endl;
         }
         
@@ -160,7 +161,7 @@ int main(int argc, char* argv[])
         complexTypeInput.setcomplexTypeElement(input);
         SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
         result = complexTypeResult->getcomplexTypeElement();
-        strftime(returnString, 50, "%H:%M:%S", &result);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(&result));
         cout << "within complex type=" << returnString << endl;
         delete complexTypeResult;
 



Mime
View raw message