axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r1124384 - in /axis/axis1/c/trunk/tests/auto_build/testcases/client/c: AxisBenchClient.c CommonClientTestCode.h XSD_dateTimeClient.c XSD_timeClient.c
Date Wed, 18 May 2011 19:02:14 GMT
Author: nadiramra
Date: Wed May 18 19:02:14 2011
New Revision: 1124384

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

Modified:
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/AxisBenchClient.c
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateTimeClient.c
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_timeClient.c

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/AxisBenchClient.c
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/AxisBenchClient.c?rev=1124384&r1=1124383&r2=1124384&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/AxisBenchClient.c (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/AxisBenchClient.c Wed May 18 19:02:14
2011
@@ -170,7 +170,7 @@ int main(int argc, char* argv[])
                 printf( " IntegerType %lld\n", outArray[i]->IntegerType );
                 printf( " DoubleType %g\n", outArray[i]->DoubleType );
                 printf( " BooleanType %d\n", outArray[i]->BooleanType );
-                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));
                 printf( " DateTimeType %s\n", dateTime );
                 strftime(dateTime, 50, "%a %b %d %Y", &outArray[i]->DateType);
                 printf( " DateType %s\n", dateTime );

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h?rev=1124384&r1=1124383&r2=1124384&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h Wed May
18 19:02:14 2011
@@ -7,6 +7,8 @@
  */
 
 #include <stdio.h>
+#include <time.h>
+#include <string.h>
 
 #define C_BOOL  int
 #define C_FALSE (int)0
@@ -145,6 +147,69 @@ char * asciiToStringOfLength( char * pSt
 
 #endif
 
+
+// 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)
+
+C_BOOL isDSTInEffect()
+{
+    time_t currentTime;
+    struct tm *ts;
+
+    (void)time(&currentTime);
+    ts = localtime(&currentTime);
+
+    if (ts->tm_isdst > 0)
+        return C_TRUE;
+
+    return C_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;
+}
+
+
+
 static C_BOOL exceptionOccurred = C_FALSE;
 void exceptionHandler(int errorCode, const char *errorString, void *pSoapFault, void *pSoapFaultDetail)
 {
@@ -152,4 +217,4 @@ void exceptionHandler(int errorCode, con
     printf("AxisException : %s\n", errorString);
 }
 
-#endif
\ No newline at end of file
+#endif

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateTimeClient.c
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateTimeClient.c?rev=1124384&r1=1124383&r2=1124384&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateTimeClient.c (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateTimeClient.c Wed May 18
19:02:14 2011
@@ -50,14 +50,14 @@ int main(int argc, char* argv[])
 
     // Test non-nillable element
     result = asNonNillableElement(ws, input);
-    strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", &result);
+    strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&result));
     printf( "non-nillable element=%s\n" , returnString );
 
     // Test nillable element, with a value
     nillableResult = asNillableElement(ws, &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));
         printf( "nillable element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_DATETIME);
     }
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
     nillableResult = asNillableElement(ws, 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));
         printf( "nil element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_DATETIME);
     }
@@ -83,7 +83,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.requiredAttribute= (input);
         requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
         result = requiredAttributeResult->requiredAttribute;
-        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", &result);
+        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&result));
         printf( "required attribute=%s\n" , returnString );
         Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
     }
@@ -145,7 +145,7 @@ int main(int argc, char* argv[])
 
         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]));
             printf( "  element[%d]=%s\n", i , returnString );
         }
 
@@ -161,7 +161,7 @@ int main(int argc, char* argv[])
         complexTypeInput.complexTypeElement = input;
         complexTypeResult = asComplexType(ws, &complexTypeInput);
         result = complexTypeResult->complexTypeElement;
-        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", &result);
+        strftime(returnString, 50, "%a %b %d %H:%M:%S %Y", adjustTimeStruct(&result));
         printf( "within complex type=%s\n" , returnString );
         Axis_Delete_SimpleComplexType(complexTypeResult, 0);
     }

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_timeClient.c
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_timeClient.c?rev=1124384&r1=1124383&r2=1124384&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_timeClient.c (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_timeClient.c Wed May 18 19:02:14
2011
@@ -50,14 +50,14 @@ int main(int argc, char* argv[])
 
     // Test non-nillable element
     result = asNonNillableElement(ws, input);
-    strftime(returnString, 50, "%H:%M:%S", &result);
+    strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(&result));
     printf("non-nillable element=%s\n" , returnString );
 
     // Test nillable element, with a value
     nillableResult = asNillableElement(ws, &input);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%H:%M:%S", nillableResult);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(nillableResult));
         printf("nillable element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_TIME);
     }
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
     nillableResult = asNillableElement(ws, NULL);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%H:%M:%S", nillableResult);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(nillableResult));
         printf("nil element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_TIME);
     }
@@ -83,7 +83,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.requiredAttribute = input;
         requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
         result = requiredAttributeResult->requiredAttribute;
-        strftime(returnString, 50, "%H:%M:%S", &result);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(&result));
         printf("required attribute=%s\n" , returnString );
         Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
     }
@@ -147,7 +147,7 @@ int main(int argc, char* argv[])
         printf("array of %d elements\n" , outputSize);
         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]));
             printf("  element[%d]=%s\n" , i , returnString );
         }
         
@@ -166,7 +166,7 @@ int main(int argc, char* argv[])
         complexTypeInput.complexTypeElement = input;
         complexTypeResult = asComplexType(ws, &complexTypeInput);
         result = complexTypeResult->complexTypeElement;
-        strftime(returnString, 50, "%H:%M:%S", &result);
+        strftime(returnString, 50, "%H:%M:%S", adjustTimeStruct(&result));
         printf("within complex type=%s\n" , returnString );
         Axis_Delete_SimpleComplexType(complexTypeResult, 0);
     }



Mime
View raw message