PropertyExpansionRequestFilter extends AbstractRequestFilter { @Override public void filterAbstractHttpRequest(SubmitContext context, AbstractHttpRequest<?> request) { String content = (String) context.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); if (content == null) { log.warn("Missing request content in context, skipping property expansion"); } else { content = PropertyExpander.expandProperties(context, content, request.getSettings().getBoolean(CommonSettings.ENTITIZE_PROPERTIES)); if (content != null) { context.setProperty(BaseHttpRequestTransport.REQUEST_CONTENT, content); } } }  @Override void filterAbstractHttpRequest(SubmitContext context, AbstractHttpRequest<?> request); static String expandProperties(SubmitContext context, String content); static String getGlobalProperty(String propertyName); static String extractXPathPropertyValue(Object property, String xpath); final static Logger log; }
@Test public void performsPropertyExpansionOnWsdlTestRequestContent() throws SoapUIException { AbstractHttpRequest request = mockRequest(WsdlTestRequest.class); requestFilter.filterAbstractHttpRequest(submitContext, request); String contentAfterPropertyExpansion = (String) submitContext.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); assertThat(contentAfterPropertyExpansion, is(EXPECTED_REQUEST_CONTENT_AFTER_PROPERTY_EXPANSION)); }
@Test public void performsPropertyExpansionOnRestTestRequestContent() throws SoapUIException { AbstractHttpRequest request = mockRequest(RestTestRequest.class); requestFilter.filterAbstractHttpRequest(submitContext, request); String contentAfterPropertyExpansion = (String) submitContext.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); assertThat(contentAfterPropertyExpansion, is(EXPECTED_REQUEST_CONTENT_AFTER_PROPERTY_EXPANSION)); }
@Test public void performsPropertyExpansionOnHttpTestRequestContent() throws SoapUIException { AbstractHttpRequest request = mockRequest(HttpTestRequest.class); requestFilter.filterAbstractHttpRequest(submitContext, request); String contentAfterPropertyExpansion = (String) submitContext.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); assertThat(contentAfterPropertyExpansion, is(EXPECTED_REQUEST_CONTENT_AFTER_PROPERTY_EXPANSION)); }
@Test public void performsPropertyExpansionOnWsdlRequestContent() throws SoapUIException { AbstractHttpRequest request = mockRequest(WsdlRequest.class); requestFilter.filterAbstractHttpRequest(submitContext, request); String contentAfterPropertyExpansion = (String) submitContext.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); assertThat(contentAfterPropertyExpansion, is(EXPECTED_REQUEST_CONTENT_AFTER_PROPERTY_EXPANSION)); }
@Test public void performsPropertyExpansionOnRestRequestContent() throws SoapUIException { AbstractHttpRequest request = mockRequest(RestRequest.class); requestFilter.filterAbstractHttpRequest(submitContext, request); String contentAfterPropertyExpansion = (String) submitContext.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); assertThat(contentAfterPropertyExpansion, is(EXPECTED_REQUEST_CONTENT_AFTER_PROPERTY_EXPANSION)); }
@Test public void performsPropertyExpansionOnHttpRequestContent() throws SoapUIException { AbstractHttpRequest request = mockRequest(HttpRequest.class); requestFilter.filterAbstractHttpRequest(submitContext, request); String contentAfterPropertyExpansion = (String) submitContext.getProperty(BaseHttpRequestTransport.REQUEST_CONTENT); assertThat(contentAfterPropertyExpansion, is(EXPECTED_REQUEST_CONTENT_AFTER_PROPERTY_EXPANSION)); }