ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r391450 - in /webservices/axis/trunk/c/tests/auto_build/testcases/client/c: AxisBenchClient.c SimpleTypeArrayClient.c
Date Tue, 04 Apr 2006 23:36:51 GMT
Author: nadiramra
Date: Tue Apr  4 16:36:50 2006
New Revision: 391450

URL: http://svn.apache.org/viewcvs?rev=391450&view=rev
Log:
C support fixes/enhancements.

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/AxisBenchClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/SimpleTypeArrayClient.c

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/AxisBenchClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/AxisBenchClient.c?rev=391450&r1=391449&r2=391450&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/AxisBenchClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/AxisBenchClient.c Tue Apr
 4 16:36:50 2006
@@ -13,42 +13,50 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "AxisBench.h"
+#include <stdlib.h>
+#include <stdio.h>
 #include <time.h>
+
+#include <axis/Axis.h>
+#include "CommonClientTestCode.h"
+#include "AxisBench.h"
+
 int main(int argc, char* argv[])
 { 
-
   BenchDataType *input;
   BenchDataType *output;
   BenchBasicDataType *pTemp;
   time_t tim;
   int i;
   void * pStub;
-  
-  xsd__unsignedByte* buffer;
+  xsdc__unsignedByte* buffer;
+  char *uri = "http://localhost:9080/AxisBench/services/AxisBenchSoapImpl";
 
+  axiscRegisterExceptionHandler(exceptionHandler);
   
-  pStub = get_AxisBench_stub ("http://localhost:9080/AxisBench/services/AxisBenchSoapImpl");
+  if (argc>1) 
+    uri = argv[1];
+
+  pStub = get_AxisBench_stub (uri);
 
   input = Axis_Create_BenchDataType(0,0,0);
 
-	input->count = 100;
-	input->infos.m_Array = Axis_Create_BenchBasicDataType(NULL,1,input->count);
-	input->infos.m_Size = input->count;
+  input->count = 100;
+  input->infos.m_Array = Axis_Create_BenchBasicDataType(NULL,1,input->count);
+  input->infos.m_Size = input->count;
 
   tim = 1079010407;
-
   gmtime(&tim);
 
   pTemp = input->infos.m_Array;
 
-  buffer = (xsd__unsignedByte*)malloc ( input->count + 2 );
+  buffer = (xsdc__unsignedByte*)malloc ( input->count + 2 );
   memset (buffer,0,input->count + 2);
 
-
-  for ( i = 0; i < input->count ; i++ ) {
+  for ( i = 0; i < input->count ; i++ ) 
+  {
     BenchBasicDataType *type = Axis_Create_BenchBasicDataType(0,0,0);
-    type->StringType = strdup("StringType");
+    type->StringType = c_strdup("StringType");
     type->IntegerType = i;
     type->DoubleType = 1;/*i/10;*/
     type->BooleanType = true_;
@@ -56,13 +64,13 @@
     type->DateType = *gmtime(&tim);
     type->TimeType = *gmtime(&tim);
 
-	  type->IntType = i;
-	  type->ByteType = '1';
-  	type->DecimalType = 10;
-  	type->FloatType = i/2;
-  	type->LongType = i*100;
-	  type->QNameType = strdup("toto");
-  	type->ShortType = 1;
+    type->IntType = i;
+    type->ByteType = '1';
+    type->DecimalType = 10;
+    type->FloatType = i/2;
+    type->LongType = i*100;
+    type->QNameType = c_strdup("toto");
+    type->ShortType = 1;
 
     type->Base64BinaryType.__size=i;
     type->Base64BinaryType.__ptr=buffer;
@@ -71,41 +79,41 @@
     strcat ( (char *)buffer, "A");
  
     pTemp[i] = *type;
-
   }
 
   output = doBenchRequest(pStub,input);
 
-  if ( get_AxisBench_Status(pStub) == AXIS_FAIL ) 
+  if (exceptionOccurred == C_TRUE ||
+      get_AxisBench_Status(pStub) == AXISC_FAIL ) 
     printf ("Failed\n");
-  else {  
-  BenchBasicDataType *pTemp;
-  pTemp = output->infos.m_Array;
-  printf ("Count : %d \n", output->count);
-  for ( i = 0; i < output->count ; i++ ) {
-    printf (" ----------------------------------------------\n");
-    printf (" StringType %s \n", pTemp[i].StringType);
-    printf (" IntegerType %d \n", pTemp[i].IntegerType);
-    printf (" DoubleType %f \n", pTemp[i].DoubleType);
-    printf (" BooleanType %d \n", pTemp[i].BooleanType);
-    printf (" DateTimeType %s \n", asctime(&pTemp[i].DateTimeType));
-    printf (" DateType %s \n", asctime(&pTemp[i].DateType));
-    printf (" TimeType %s \n", asctime(&pTemp[i].TimeType));
-    printf (" ByteType %d \n", pTemp[i].ByteType);
-    printf (" DecimalType %f \n", pTemp[i].DecimalType);
-    printf (" FloatType %f \n", pTemp[i].FloatType);
-    printf (" LongType %ld \n", pTemp[i].LongType);
-    printf (" QNameType %s \n", pTemp[i].QNameType);
-    printf (" ShortType %d \n", pTemp[i].ShortType);
-
-    printf (" Base64BinaryType %d \n", output->infos.m_Array[i].Base64BinaryType.__size);
-    printf (" Base64BinaryType %s \n", output->infos.m_Array[i].Base64BinaryType.__ptr);
-
-    printf (" HexBinaryType %d \n", output->infos.m_Array[i].HexBinary.__size);
-    printf (" HexBinaryType %s \n", output->infos.m_Array[i].HexBinary.__ptr);
-
+  else 
+  {  
+      BenchBasicDataType *pTemp;
+      pTemp = output->infos.m_Array;
+      printf ("Count : %d \n", output->count);
+      for ( i = 0; i < output->count ; i++ ) 
+      {
+        printf (" ----------------------------------------------\n");
+        printf (" StringType %s \n", pTemp[i].StringType);
+        printf (" IntegerType %d \n", pTemp[i].IntegerType);
+        printf (" DoubleType %f \n", pTemp[i].DoubleType);
+        printf (" BooleanType %d \n", pTemp[i].BooleanType);
+        printf (" DateTimeType %s \n", asctime(&pTemp[i].DateTimeType));
+        printf (" DateType %s \n", asctime(&pTemp[i].DateType));
+        printf (" TimeType %s \n", asctime(&pTemp[i].TimeType));
+        printf (" ByteType %d \n", pTemp[i].ByteType);
+        printf (" DecimalType %f \n", pTemp[i].DecimalType);
+        printf (" FloatType %f \n", pTemp[i].FloatType);
+        printf (" LongType %ld \n", pTemp[i].LongType);
+        printf (" QNameType %s \n", pTemp[i].QNameType);
+        printf (" ShortType %d \n", pTemp[i].ShortType);
     
-  }
+        printf (" Base64BinaryType %d \n", output->infos.m_Array[i].Base64BinaryType.__size);
+        printf (" Base64BinaryType %s \n", output->infos.m_Array[i].Base64BinaryType.__ptr);
+    
+        printf (" HexBinaryType %d \n", output->infos.m_Array[i].HexBinary.__size);
+        printf (" HexBinaryType %s \n", output->infos.m_Array[i].HexBinary.__ptr);
+      }
   }
   
   Axis_Delete_BenchDataType (input,0,0);

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/SimpleTypeArrayClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/SimpleTypeArrayClient.c?rev=391450&r1=391449&r2=391450&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/SimpleTypeArrayClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/SimpleTypeArrayClient.c Tue
Apr  4 16:36:50 2006
@@ -13,44 +13,64 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "SimpleTypeArrayWS.h" 
-int main(int argc, char* argv[])
-{ 
+#include "CommonClientTestCode.h"
 
-  void *pStub;
-  Type *input;
-  Type *output;
-  xsd__int_Array array_input;
-  xsd__int_Array array_output;
-  int * entries;
-  int i;
-
-  entries = malloc ( sizeof (int) );
-
-  array_input.m_Array = entries;
-  array_input.m_Size  = 100;
-
-  for ( i = 0; i < 100; i++ ) {
-    entries[i] = i;
-  }
-
-  input = Axis_Create_Type(0,0,0);
-  input->item = array_input;
-
-  pStub = 
-    get_SimpleTypeArrayWS_stub();
-  
-  output = getInput(pStub, input);
-
-  for ( i = 0; i < 100; i++ ) {
-    printf ("item [%d] = %d\n",i,output->item.m_Array[i]);
-  }
-  
-  Axis_Delete_Type(input,0,0);
-  Axis_Delete_Type(output,0,0);
+#include "SimpleTypeArrayWS.h" 
 
-  destroy_SimpleTypeArrayWS_stub(pStub);
+#include <stdio.h>
 
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/SimpleTypeArray/services/sampleWS"
 
+int main(int argc, char* argv[])
+{ 
+    AXISCHANDLE ws = NULL;
+    char *endpoint = WSDL_DEFAULT_ENDPOINT;
+    int returnValue = 1; /* Assume Failure */
+    Type *input;
+    Type *output;
+    xsdc__int_Array array_input;
+    xsdc__int_Array *array_output;
+    xsdc__int * array[100];
+    xsdc__int   elements[100];
+    int i;
+
+    if (argc>2 && strcmp(argv[1], "-e") == 0) 
+        endpoint = argv[2];   
+
+    for ( i = 0; i < 100; i++ )
+    {     
+      elements[i] = i;
+      array[i]    = &elements[i];
+    }
+    
+    array_input.m_Array = array;
+    array_input.m_Size  = 100;
+    array_input.m_Type  = XSD_INT;
+
+    input = Axis_Create_Type(0,0,0);
+    input->item = &array_input;
+
+    ws = get_SimpleTypeArrayWS_stub(endpoint);
+    output = getInput(ws, input);
+    
+    if (exceptionOccurred == C_TRUE ||
+        get_SimpleTypeArrayWS_Status(ws) == AXISC_FAIL ||
+        output == NULL || output->item == NULL)
+       printf("FAILED\n");
+    else
+    {
+       returnValue = 0;
+       for ( i = 0; i < 100; i++ )
+         printf ("item [%d] = %d\n",i,output->item->m_Array[i]);
+    }
+    
+    input->item = NULL;
+    Axis_Delete_Type(input,0,0);
+    Axis_Delete_Type(output,0,0);
+    
+    destroy_SimpleTypeArrayWS_stub(ws);
+   
+    printf("---------------------- TEST COMPLETE -----------------------------\n");   
+    return returnValue; 
 }
 



Mime
View raw message