1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.support;
14
15 import java.io.File;
16 import java.io.IOException;
17
18 import com.eviware.soapui.config.AttachmentConfig;
19 import com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse;
20
21 /***
22 * Attachments cached locally for each request
23 *
24 * @author Ole.Matzura
25 */
26
27 public class MockFileAttachment extends FileAttachment
28 {
29 private final WsdlMockResponse mockResponse;
30
31 public MockFileAttachment( AttachmentConfig config, WsdlMockResponse mockResponse )
32 {
33 super( config );
34 this.mockResponse = mockResponse;
35 }
36
37 public MockFileAttachment( File file, boolean cache, WsdlMockResponse response ) throws IOException
38 {
39 super(file, cache, response.getConfig().addNewAttachment());
40 mockResponse = response;
41 }
42
43 @Override
44 public AttachmentType getAttachmentType()
45 {
46 if( getPart() == null || mockResponse.getAttachmentPart( getPart() ) == null )
47 return AttachmentType.UNKNOWN;
48 else
49 return mockResponse.getAttachmentPart( getPart() ).getAttachmentType();
50 }
51 }