@Test public void testTransformRequestShouldAddHeaders() throws ApplicationException { setMocksForHeader(); setMocksForMessageConfiguration(); WilmaHttpRequest actual = underTest.transformRequest(browserMobHttpRequest); verify(wilmaHttpRequest).addHeader(Mockito.anyString(), Mockito.anyString()); assertEquals(actual.getRequestLine(), wilmaHttpRequest.getRequestLine()); assertEquals(actual.getHeader("header"), wilmaHttpRequest.getHeader("header")); }
public WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest) throws ApplicationException { WilmaHttpRequest result = requestFactory.createNewWilmaHttpRequest(); HttpRequestBase requestBase = browserMobHttpRequest.getMethod(); result.setRequestLine(requestBase.getRequestLine().toString()); for (Header header : requestBase.getAllHeaders()) { result.addHeader(header.getName(), header.getValue()); } InputStream clonedInputStream = browserMobHttpRequest.getPlayGround(); result.setInputStream(clonedInputStream); result.setBody(inputStreamConverter.getStringFromStream(clonedInputStream)); result.setUri(requestBase.getURI()); result.setResponseVolatile(browserMobHttpRequest.getResponseVolatile()); MessagePropertyDTO properties = configurationAccess.getProperties(); String instancePrefix = properties.getInstancePrefix(); if (instancePrefix != null) { instancePrefix += "_"; } else { instancePrefix = ""; } result.setWilmaMessageId(instancePrefix + browserMobHttpRequest.getWilmaMessageId()); String ipAddress = browserMobHttpRequest.getProxyRequest().getRemoteAddr(); result.setRemoteAddr(ipAddress); return result; }
HttpRequestTransformer { public WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest) throws ApplicationException { WilmaHttpRequest result = requestFactory.createNewWilmaHttpRequest(); HttpRequestBase requestBase = browserMobHttpRequest.getMethod(); result.setRequestLine(requestBase.getRequestLine().toString()); for (Header header : requestBase.getAllHeaders()) { result.addHeader(header.getName(), header.getValue()); } InputStream clonedInputStream = browserMobHttpRequest.getPlayGround(); result.setInputStream(clonedInputStream); result.setBody(inputStreamConverter.getStringFromStream(clonedInputStream)); result.setUri(requestBase.getURI()); result.setResponseVolatile(browserMobHttpRequest.getResponseVolatile()); MessagePropertyDTO properties = configurationAccess.getProperties(); String instancePrefix = properties.getInstancePrefix(); if (instancePrefix != null) { instancePrefix += "_"; } else { instancePrefix = ""; } result.setWilmaMessageId(instancePrefix + browserMobHttpRequest.getWilmaMessageId()); String ipAddress = browserMobHttpRequest.getProxyRequest().getRemoteAddr(); result.setRemoteAddr(ipAddress); return result; } }
HttpRequestTransformer { public WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest) throws ApplicationException { WilmaHttpRequest result = requestFactory.createNewWilmaHttpRequest(); HttpRequestBase requestBase = browserMobHttpRequest.getMethod(); result.setRequestLine(requestBase.getRequestLine().toString()); for (Header header : requestBase.getAllHeaders()) { result.addHeader(header.getName(), header.getValue()); } InputStream clonedInputStream = browserMobHttpRequest.getPlayGround(); result.setInputStream(clonedInputStream); result.setBody(inputStreamConverter.getStringFromStream(clonedInputStream)); result.setUri(requestBase.getURI()); result.setResponseVolatile(browserMobHttpRequest.getResponseVolatile()); MessagePropertyDTO properties = configurationAccess.getProperties(); String instancePrefix = properties.getInstancePrefix(); if (instancePrefix != null) { instancePrefix += "_"; } else { instancePrefix = ""; } result.setWilmaMessageId(instancePrefix + browserMobHttpRequest.getWilmaMessageId()); String ipAddress = browserMobHttpRequest.getProxyRequest().getRemoteAddr(); result.setRemoteAddr(ipAddress); return result; }  }
HttpRequestTransformer { public WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest) throws ApplicationException { WilmaHttpRequest result = requestFactory.createNewWilmaHttpRequest(); HttpRequestBase requestBase = browserMobHttpRequest.getMethod(); result.setRequestLine(requestBase.getRequestLine().toString()); for (Header header : requestBase.getAllHeaders()) { result.addHeader(header.getName(), header.getValue()); } InputStream clonedInputStream = browserMobHttpRequest.getPlayGround(); result.setInputStream(clonedInputStream); result.setBody(inputStreamConverter.getStringFromStream(clonedInputStream)); result.setUri(requestBase.getURI()); result.setResponseVolatile(browserMobHttpRequest.getResponseVolatile()); MessagePropertyDTO properties = configurationAccess.getProperties(); String instancePrefix = properties.getInstancePrefix(); if (instancePrefix != null) { instancePrefix += "_"; } else { instancePrefix = ""; } result.setWilmaMessageId(instancePrefix + browserMobHttpRequest.getWilmaMessageId()); String ipAddress = browserMobHttpRequest.getProxyRequest().getRemoteAddr(); result.setRemoteAddr(ipAddress); return result; }  WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest); }
HttpRequestTransformer { public WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest) throws ApplicationException { WilmaHttpRequest result = requestFactory.createNewWilmaHttpRequest(); HttpRequestBase requestBase = browserMobHttpRequest.getMethod(); result.setRequestLine(requestBase.getRequestLine().toString()); for (Header header : requestBase.getAllHeaders()) { result.addHeader(header.getName(), header.getValue()); } InputStream clonedInputStream = browserMobHttpRequest.getPlayGround(); result.setInputStream(clonedInputStream); result.setBody(inputStreamConverter.getStringFromStream(clonedInputStream)); result.setUri(requestBase.getURI()); result.setResponseVolatile(browserMobHttpRequest.getResponseVolatile()); MessagePropertyDTO properties = configurationAccess.getProperties(); String instancePrefix = properties.getInstancePrefix(); if (instancePrefix != null) { instancePrefix += "_"; } else { instancePrefix = ""; } result.setWilmaMessageId(instancePrefix + browserMobHttpRequest.getWilmaMessageId()); String ipAddress = browserMobHttpRequest.getProxyRequest().getRemoteAddr(); result.setRemoteAddr(ipAddress); return result; }  WilmaHttpRequest transformRequest(final BrowserMobHttpRequest browserMobHttpRequest);  }