axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hawk...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/client/c AxisBenchClient.c EnumerationClient.c LargeReturningString.c RecurseTypesClient.c SimpleTypeArrayClient.c SimpleTypeInnerUnboundedClient.c SimpleTypeInnerUnboundedInOutputClient.c TradeServicesClient.c
Date Fri, 27 Aug 2004 12:03:00 GMT
hawkeye     2004/08/27 05:03:00

  Added:       c/tests/auto_build/testcases/client/c AxisBenchClient.c
                        EnumerationClient.c LargeReturningString.c
                        RecurseTypesClient.c SimpleTypeArrayClient.c
                        SimpleTypeInnerUnboundedClient.c
                        SimpleTypeInnerUnboundedInOutputClient.c
                        TradeServicesClient.c
  Log:
  Added the C clients for the tests that I have just added. NOTE: These tests do not have
C services yet so I have not added them to any of the batch scripts that make or run the tests.
  
  Submitted by:	hawkeye
  Reviewed by:	Adrian Dick
  
  Revision  Changes    Path
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/AxisBenchClient.c
  
  Index: AxisBenchClient.c
  ===================================================================
  #include "AxisBench.h"
  #include <time.h>
  int main(int argc, char* argv[])
  { 
  
    BenchDataType *input;
    BenchDataType *output;
    BenchBasicDataType *pTemp;
    time_t tim;
    int i;
    void * pStub;
    
    xsd__unsignedByte* buffer;
  
    
    pStub = get_AxisBench_stub ("http://localhost:9080/AxisBench/services/AxisBenchSoapImpl");
  
    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;
  
    tim = 1079010407;
  
    gmtime(&tim);
  
    pTemp = input->infos.m_Array;
  
    buffer = (xsd__unsignedByte*)malloc ( input->count + 2 );
    memset (buffer,0,input->count + 2);
  
  
    for ( i = 0; i < input->count ; i++ ) {
      BenchBasicDataType *type = Axis_Create_BenchBasicDataType(0,0,0);
      type->StringType = strdup("StringType");
      type->IntegerType = i;
      type->DoubleType = 1;/*i/10;*/
      type->BooleanType = true_;
      type->DateTimeType = *gmtime(&tim);
      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->Base64BinaryType.__size=i;
      type->Base64BinaryType.__ptr=buffer;
      type->HexBinary.__size=i;
      type->HexBinary.__ptr=buffer;
      strcat ( (char *)buffer, "A");
   
      pTemp[i] = *type;
  
    }
  
    output = doBenchRequest(pStub,input);
  
    if ( get_AxisBench_Status(pStub) == AXIS_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);
  
      
    }
    }
    
    Axis_Delete_BenchDataType (input,0,0);
    Axis_Delete_BenchDataType (output,0,0);
    
    return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/EnumerationClient.c
  
  Index: EnumerationClient.c
  ===================================================================
  #include "EnumerationWS.h" 
  
  int main(int argc, char* argv[])
  { 
    void * pStub = get_EnumerationWS_stub  ();
  
    Type1 *input = Axis_Create_Type1(0,0,0);
    
    Type1* result;
  
    input->enum_int = ENUMTYPEINT_0;
    input->enum_string = strdup("one");
    input->att_enum_kind = strdup("CHEQUE");
    input->att_enum_string = strdup("one");
    input->att_enum_int = ENUMTYPEINT_1;
  
    result = getInput(pStub,input);
  
    printf ("Result\n");
    if ( result == NULL )
     printf ("NULL\n");
    else {
     printf ("att_enum_int %d\n", result->att_enum_int);
     printf ("att_enum_string %s\n", result->att_enum_string);
     printf ("enum_int %d\n", result->enum_int);
     printf ("enum_string %s\n", result->enum_string);
     printf ("enum_kind %s\n", result->att_enum_kind);
    }
  
    Axis_Delete_Type1(input,0,0);
    Axis_Delete_Type1(result,0,0);
    
    return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/LargeReturningString.c
  
  Index: LargeReturningString.c
  ===================================================================
  #include "LargeReturningString.h" 
  
  int main(int argc, char* argv[])
  { 
    void * pStub = get_LargeReturningString_stub  ();
  
    int input = 20000;
    xsd__string result;
  
    result = getLargeReturningString(pStub,input);
  
    printf ("Result\n");
    if ( result == NULL )
     printf ("NULL\n");
    else {
     printf ("%s\n", result);
    }
    
    return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/RecurseTypesClient.c
  
  Index: RecurseTypesClient.c
  ===================================================================
  #include "RecurseTypesWS.h" 
  
  int main(int argc, char* argv[])
  { 
  
    Kind inputAtt,*outputAtt;
    Type1 *input,*output,*pTemp;
    void * pStub;
    int i;
  
    pStub = get_RecurseTypesWS_stub();
  
    input = Axis_Create_Type1 (0,0,0);
  
    input->att_kind = Kind_CHEQUE;
    input->kind = strdup("Check In");
    
    input->followings.m_Array = Axis_Create_Type1 (0,1,10);
    input->followings.m_Size = 10;
  
    pTemp = input->followings.m_Array;
    for ( i = 0; i < 10; i++ ) {
      pTemp->kind = strdup("Sample");
      pTemp++;
    }
  
    output = getInput(pStub,input);
  
    printf ("Result\n");
    if ( output == NULL )
     printf ("Invoke failed\n");
    else {
     printf ("\tAtt_kind = %s\n", output->att_kind);
     printf ("\tKind = %s\n", output->kind);
     pTemp = output->followings.m_Array;
     for ( i = 0; i < output->followings.m_Size; i++ ) {
       printf ("\tKind [%d] = %s\n",i, pTemp->kind);
       pTemp++;
     }
    }
  
    /*
    Axis_Delete_Type1 (input,0,0);
    Axis_Delete_Type1 (output,0,0);
    */
    destroy_RecurseTypesWS_stub(pStub);
    return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/SimpleTypeArrayClient.c
  
  Index: SimpleTypeArrayClient.c
  ===================================================================
  #include "SimpleTypeArrayWS.h" 
  int main(int argc, char* argv[])
  { 
  
    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);
  
    destroy_SimpleTypeArrayWS_stub(pStub);
  
  
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/SimpleTypeInnerUnboundedClient.c
  
  Index: SimpleTypeInnerUnboundedClient.c
  ===================================================================
  #include "SimpleTypeInnerUnboundedWS.h" 
  
  int main(int argc, char* argv[])
  { 
    int i;
    void * pStub = get_SimpleTypeInnerUnboundedWS_stub ("http://localhost:9080/SimpleTypeInnerUnbounded/services/sampleWS");
  
    Type1 *input = Axis_Create_Type1(0,0,0);
    Type1_ident idents[10];
    
    Type1* result;
  
    input->enum_int = 1;
    input->enum_string = strdup("one");
    input->att_enum_kind = strdup("CHEQUE");
    input->att_enum_string = strdup("one");
    input->att_enum_int = 1;
  
  
    input->ident.m_Array = idents;
    input->ident.m_Size = 10;
    for ( i = 0; i < 10; i++ ) {
      idents[i] = strdup ("Hello world");
    }
  
  
  
    result = getInput(pStub,input);
  
    printf ("Result\n");
    if ( result == NULL )
     printf ("NULL\n");
    else {
     printf ("att_enum_int %d\n", result->att_enum_int);
     printf ("att_enum_string %s\n", result->att_enum_string);
     printf ("enum_int %d\n", result->enum_int);
     printf ("enum_string %s\n", result->enum_string);
     printf ("enum_kind %s\n", result->att_enum_kind);
    }
  
    //Axis_Delete_Type1(input,0,0);
    //Axis_Delete_Type1(result,0,0);
  
    destroy_SimpleTypeInnerUnboundedWS_stub(pStub);
    
    return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/SimpleTypeInnerUnboundedInOutputClient.c
  
  Index: SimpleTypeInnerUnboundedInOutputClient.c
  ===================================================================
  #include "SimpleTypeInnerUnboundedInOutputWS.h" 
  
  int main(int argc, char* argv[])
  { 
    int i;
    int size;
    void * pStub = get_SimpleTypeInnerUnboundedInOutputWS_stub ();
  
    Type1* result;
  
    size = 10;
  
    result = getInput(pStub,size);
  
    if ( result == NULL )
     printf ("NULL\n");
    else {
      Type1_ident* pTemp = result->ident.m_Array;
      for ( i = 0; i < result->ident.m_Size; i++ ) {
        printf ("Result [%d] : %s\n",i,pTemp[i]);
      }
    }
  
    Axis_Delete_Type1(result,0,0);
  
    destroy_SimpleTypeInnerUnboundedInOutputWS_stub(pStub);
    
    return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/c/TradeServicesClient.c
  
  Index: TradeServicesClient.c
  ===================================================================
  /* IBM Confidential OCO Source Material
   * 5639-D57, 5630-A36, 5630-A37, 5724-D18 (C) COPYRIGHT International Business Machines
Corp. 1997, 2002
   * The source code for this program is not published or otherwise divested
   * of its trade secrets, irrespective of what has been deposited with the
   * U.S. Copyright Office.
   *
   * Change History:
   * Date     UserId      Defect          Description
   * ----------------------------------------------------------------------------
   *
   */
  #include <stdio.h>
  #include "operations.h"
  
  int main(int argc, char* argv[]){
  	
  	void * proxy;
  	xsd__string userid;
  	long ticket;
  	int i=0;
  	Quote_Array arrayOfQuote;
  	Order_Array arrayOfOrder;
  	Quote quote;
  	Quote *myQuote;
  	Order *order;
  	Order anOrder;
  	xsd__decimal total;
  
    userid = strdup("Durand");
  
  	/* we are changing the EndpointURI here to redirect requests toward the TCP/IP Monitor
  	 * change port if using any TCP/IP traffic monitoring tool.
     */
  	proxy = get_operations_stub("http://127.0.0.1:9080/TradeApplication/services/Service");
  
  	printf("Requesting new ticket for user %s\n",userid);
  	ticket = getTicket(proxy,userid);
  	printf("-> received ticket: %ld\n",ticket);
  
  	printf("Requesting the Quote list\n");
  	arrayOfQuote = getAllQuotes(proxy,userid,ticket);
  	printf("-> received %d Quotes\n",arrayOfQuote.m_Size);
  
  	for(i=0;i<arrayOfQuote.m_Size;i++){
  		quote = arrayOfQuote.m_Array[i];
  		printf("    - %s %s $%f\n",quote.symbol,quote.label,quote.price);
  	}
  
  	printf("Requesting orders to buy some Stocks...\n");
  	printf("Order 1: 10 * q:3\n");
  	order = buyQuote(proxy,userid,ticket,10,arrayOfQuote.m_Array+3);
  	printf("-> transaction ok. id:%d\n",order->reference);
    Axis_Delete_Order (order,0,0);
  
  	printf("Order 2: 7 * q:6\n");
  	order = buyQuote(proxy,userid,ticket,7,arrayOfQuote.m_Array+6);
  	printf("-> transaction ok. id:%d\n",order->reference);
    Axis_Delete_Order (order,0,0);
  
  	/* Another way to do the same call: with a user-created quote structure */
  	printf("Order 3: 3 * q:9\n");
  	myQuote = Axis_Create_Quote(NULL,0,0);
  	order = buyQuote(proxy,userid,ticket,3,arrayOfQuote.m_Array+9);
  	printf("-> transaction ok. id:%d\n",order->reference);
  	Axis_Delete_Quote(myQuote,0,0);
    Axis_Delete_Order (order,0,0);
  
  	printf("Requesting my Orders list\n");
  	arrayOfOrder = getAllOrders(proxy,userid,ticket);
  	printf("-> received %d Orders\n",arrayOfOrder.m_Size);
  
  	for(i=0;i<arrayOfOrder.m_Size;i++){
  		anOrder = arrayOfOrder.m_Array[i];
  		printf("    - %d %s $%f %d\n",anOrder.reference,anOrder.symbol,anOrder.price,anOrder.quantity);
  	}
  
  	printf("Requesting my portfolio value\n");
  	total = computePortfolio(proxy,userid,ticket);
  	printf("-> value = $%f\n",total);
  
    /* Free */
  	Axis_Delete_Quote(arrayOfQuote.m_Array,1,arrayOfQuote.m_Size);
    Axis_Delete_Order (arrayOfOrder.m_Array,1,arrayOfOrder.m_Size);
    free (userid);
    
      printf ("Compilation success\n"); 
  
  	return 0;
  }
  
  
  

Mime
View raw message