axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whitl...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/output DynUnrefAttachmentTest.expected
Date Wed, 15 Jun 2005 21:25:00 GMT
whitlock    2005/06/15 14:25:00

  Modified:    c/src/soap SoapAttachmentHeaders.cpp SoapSerializer.cpp
               c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest
                        DynUnrefAttachmentTest.cpp
               c/tests/auto_build/testcases/output
                        DynUnrefAttachmentTest.expected
  Log:
  Unreferenced attachments
  Better testing and more fixes
  
  Revision  Changes    Path
  1.2       +19 -5     ws-axis/c/src/soap/SoapAttachmentHeaders.cpp
  
  Index: SoapAttachmentHeaders.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapAttachmentHeaders.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SoapAttachmentHeaders.cpp	15 Jun 2005 13:37:31 -0000	1.1
  +++ SoapAttachmentHeaders.cpp	15 Jun 2005 21:25:00 -0000	1.2
  @@ -48,20 +48,34 @@
   
   void SoapAttachmentHeaders::addHeader(AxisString name, AxisString value)
   {
  -	m_AttachHeaders.push_back (make_pair (name, value));
  +	bool found = false;
  +	if (name == AXIS_CONTENT_ID)
  +	{
  +		for (unsigned int i = 0; i < m_AttachHeaders.size (); i++)
  +		{
  +			if (m_AttachHeaders[i].first == name)
  +			{
  +				m_AttachHeaders[i] = make_pair(name, value);
  +				found = true;
  +				break;
  +			}
  +		}
  +	}
  +
  +	if (!found)
  +		m_AttachHeaders.push_back (make_pair (name, value));
   }
   
   void SoapAttachmentHeaders::serialize(SoapSerializer &pSZ)
   {
  -
   	for (unsigned int i = 0; i < m_AttachHeaders.size (); i++)
   	{
  -	    if (m_AttachHeaders[i].first == "Content-Id")
  +	    if (m_AttachHeaders[i].first == AXIS_CONTENT_ID)
   	    {
   			pSZ.serialize((m_AttachHeaders[i].first).c_str(), ": <", NULL);
   			pSZ.serialize((m_AttachHeaders[i].second).c_str(), ">\n", NULL);
   		} else {
  -			pSZ.serialize((m_AttachHeaders[i].first).c_str(), ":", NULL);
  +			pSZ.serialize((m_AttachHeaders[i].first).c_str(), ": ", NULL);
   			pSZ.serialize((m_AttachHeaders[i].second).c_str(), "\n", NULL); 
   		}
   	}
  @@ -72,7 +86,7 @@
   
   	for (unsigned int i = 0; i < m_AttachHeaders.size (); i++)
   	{
  -		if (m_AttachHeaders[i].first == "Content-Id")
  +		if (m_AttachHeaders[i].first == AXIS_CONTENT_ID)
   		{
   			return m_AttachHeaders[i].second;
   		}
  
  
  
  1.125     +16 -9     ws-axis/c/src/soap/SoapSerializer.cpp
  
  Index: SoapSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- SoapSerializer.cpp	15 Jun 2005 20:24:22 -0000	1.124
  +++ SoapSerializer.cpp	15 Jun 2005 21:25:00 -0000	1.125
  @@ -326,13 +326,23 @@
   				}
   				else
   				{	// Client code
  -					pStream->setTransportProperty( AXIS_CONTENT_TYPE, 
  -						"multipart/related; type=\"text/xml\"; boundary=\"" MIMEBOUNDARY "\"");
  +					const char *id = m_pContentIdSet->generateId();
  +					string ctype = "multipart/related; type=\"text/xml\"; boundary=\"";
  +					ctype += MIMEBOUNDARY;
  +					ctype += "\"; start=\"<";
  +					ctype += id;
  +					ctype += ">\"";
  +					pStream->setTransportProperty( AXIS_CONTENT_TYPE, ctype.c_str());
  +
   					serialize("\n" MIMEBOUNDARY "\n", NULL);
                       serialize(AXIS_CONTENT_TYPE ": text/xml; charset=UTF-8\n", NULL);
                       serialize(AXIS_CONTENT_TRANSFER_ENCODING ": binary\n", NULL);
  -                    serialize(AXIS_CONTENT_ID ": <4E2B3048B540B4C3271D6A6726571E0F>\n",
NULL);  // TODO: needs changing
  -                    serialize("\n", NULL);  // Extra \n terminates headers
  +
  +					string cid = AXIS_CONTENT_ID;
  +					cid += ": <";
  +					cid += id;
  +					cid += ">\n\n";		// Extra \n terminates headers
  +                    serialize(cid.c_str(), NULL);
   				}
   			}
   
  @@ -1130,17 +1140,14 @@
   void SoapSerializer::serializeAttachments( SoapSerializer &pSZ)
   {
   	/*serializing the attachments*/
  -
   	map<AxisXMLString, ISoapAttachment*>::iterator itCurrAttach= m_SoapAttachments.begin();
  -
   	while( itCurrAttach != m_SoapAttachments.end())
       {        
           ((SoapAttachment *) ((*itCurrAttach).second))->serialize(pSZ);
  -
  -		pSZ.serialize("\n" MIMEBOUNDARY "\n", NULL);
  -
  +		pSZ.serialize("\n" MIMEBOUNDARY, NULL);
           itCurrAttach++;
       }
  +	pSZ.serialize("\n", NULL);
   }
   
   void SoapSerializer::addAttachment( const AxisChar * achId, ISoapAttachment * pAttach)
  
  
  
  1.5       +26 -11    ws-axis/c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest/DynUnrefAttachmentTest.cpp
  
  Index: DynUnrefAttachmentTest.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest/DynUnrefAttachmentTest.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DynUnrefAttachmentTest.cpp	15 Jun 2005 20:24:22 -0000	1.4
  +++ DynUnrefAttachmentTest.cpp	15 Jun 2005 21:25:00 -0000	1.5
  @@ -29,24 +29,39 @@
   		Call call;
   		call.setEndpointURI(argv[1]);
   
  -		ISoapAttachment *att = call.createSoapAttachment();
  -		// att->addHeader(AXIS_CONTENT_ID,"HERES_MY_CONTENT_ID");
  -		att->addHeader(AXIS_CONTENT_TYPE,"text/plain");
  -		att->addHeader(AXIS_CONTENT_TRANSFER_ENCODING,"base64");
  -		
  -		xsd__base64Binary b64b;
  -		char *text = "This is the attachment body for the DynUnrefAttachmentTest";
  -		b64b.__ptr = (xsd__unsignedByte*)text;
  -		b64b.__size = strlen(text)+1;
  -		att->addBody(&b64b);
  +		////////////////////////////////////////////////////////////////////////
   
  -		call.addAttachment(att);
  +		for (int i=0; i<5; i++) 
  +		{
  +			cout << "i=" << i << endl;
  +			ISoapAttachment *att = call.createSoapAttachment();
  +
  +			try {
  +				if (!(i%3)) att->addHeader(AXIS_CONTENT_ID,"HERES_MY_CONTENT_ID");
  +			} catch (AxisException &ae) {
  +				cout << ae.what() << endl;
  +			}
  +
  +			att->addHeader(AXIS_CONTENT_TYPE,"text/plain");
  +			att->addHeader(AXIS_CONTENT_TRANSFER_ENCODING,"base64");
  +			
  +			xsd__base64Binary b64b;
  +			char *text = "This is the attachment body for the DynUnrefAttachmentTest";
  +			b64b.__ptr = (xsd__unsignedByte*)text;
  +			b64b.__size = strlen(text)+1;
  +			att->addBody(&b64b);	
  +
  +			call.addAttachment(att);
  +		}
  +
  +		////////////////////////////////////////////////////////////////////////
   
   		call.initialize(CPP_DOC_PROVIDER);
   		call.setSOAPVersion(SOAP_VER_1_1);
   		call.setTransportProperty(SOAPACTION_HEADER , "Trash");
   		call.setOperation("put", "http://localhost/axis/DynUnrefAttachment");
   
  +		cout << "Invoking..." << endl;
   		if (AXIS_SUCCESS != call.invoke())
   		{
   			cout << "Invoke failed" << endl;
  
  
  
  1.2       +7 -0      ws-axis/c/tests/auto_build/testcases/output/DynUnrefAttachmentTest.expected
  
  Index: DynUnrefAttachmentTest.expected
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/output/DynUnrefAttachmentTest.expected,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DynUnrefAttachmentTest.expected	14 Jun 2005 09:31:21 -0000	1.1
  +++ DynUnrefAttachmentTest.expected	15 Jun 2005 21:25:00 -0000	1.2
  @@ -1 +1,8 @@
  +i=0
  +i=1
  +i=2
  +i=3
  +AxisSoapException:Content is not unique within the MIME message
  +i=4
  +Invoking...
   ----------------------------TEST COMPLETE--------------------------------
  
  
  

Mime
View raw message