1 package com.eviware.soapui.impl.wsdl;
2
3 import java.io.File;
4
5 import junit.framework.TestCase;
6
7 import com.eviware.soapui.impl.wsdl.WsdlAttachmentPart;
8 import com.eviware.soapui.impl.wsdl.WsdlInterface;
9 import com.eviware.soapui.impl.wsdl.WsdlOperation;
10 import com.eviware.soapui.impl.wsdl.WsdlProject;
11 import com.eviware.soapui.impl.wsdl.WsdlRequest;
12
13 public class AttachmentTestCase extends TestCase
14 {
15 public void test() throws Exception
16 {
17 String wsdlUrl = new File( "src/test-resources/attachment-test.wsdl" ).toURL().toString();
18 WsdlProject project = new WsdlProject();
19 WsdlInterface iface = project.importWsdl( wsdlUrl, false )[0];
20
21 WsdlOperation operation = (WsdlOperation) iface.getOperationByName( "SendClaim" );
22 WsdlRequest request = operation.addNewRequest( "Test" );
23
24 request.setRequestContent( operation.createRequest( true ));
25
26 System.out.println( request.getRequestContent() );
27
28 WsdlAttachmentPart[] definedAttachmentParts = request.getDefinedAttachmentParts();
29
30 assertEquals( definedAttachmentParts.length, 4 );
31 assertEquals( definedAttachmentParts[0].getName(), "ClaimPhoto" );
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 }
54 }