use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class ProxyAdjacentPeerAddressHandlerTest method shouldObtainRightMostAddressFromChain.
@Test
public void shouldObtainRightMostAddressFromChain() throws IOException, InterruptedException {
final URL url = new URL(String.format(URL_STRING, server.host, server.port) + URL_QUERY_STRING);
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("X-Forwarded-For", "127.0.0.1,192.168.13.23");
conn.setRequestMethod("GET");
assertEquals(200, conn.getResponseCode());
final EventPayload payload = server.waitForEvent();
assertEquals("192.168.13.23", payload.event.exchange.getSourceAddress().getHostString());
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class RequestChecksumTest method shouldFlagIncorrectChecksumAsCorrupted.
@Test
public void shouldFlagIncorrectChecksumAsCorrupted() throws IOException, InterruptedException {
request(URL_QUERY_CHECKSUM_BAD);
Preconditions.checkState(null != server);
final EventPayload payload = server.waitForEvent();
assertTrue(payload.event.corruptEvent);
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class RequestChecksumTest method shouldFlagCorrectChecksumAsNotCorrupted.
@Test
public void shouldFlagCorrectChecksumAsNotCorrupted() throws IOException, InterruptedException {
request(URL_QUERY_CHECKSUM_GOOD);
Preconditions.checkState(null != server);
final EventPayload payload = server.waitForEvent();
assertFalse(payload.event.corruptEvent);
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class RequestChecksumTest method shouldDiscardCorruptedEventsIfConfigured.
@Test
public void shouldDiscardCorruptedEventsIfConfigured() throws InterruptedException, IOException {
discardCorruptEvents = true;
request(URL_QUERY_CHECKSUM_BAD);
request(URL_QUERY_SENTINEL);
Preconditions.checkState(null != server);
final EventPayload payload = server.waitForEvent();
// The first request should be missing, and we should now have the sentinel event.
assertEquals(Optional.of("sentinelEvent"), payload.event.eventType);
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class SeleniumDisabledAutoPageViewEventTest method shouldFireOnlyCustomPageViewEvent.
@Test
public void shouldFireOnlyCustomPageViewEvent() throws InterruptedException {
Preconditions.checkState(null != server);
gotoPage(CUSTOM_PAGE_VIEW);
final EventPayload payload = server.waitForEvent();
final DivolteEvent eventData = payload.event;
final Optional<String> eventParameters = eventData.eventParametersProducer.get().map(Object::toString);
assertTrue(eventParameters.isPresent());
assertEquals("{\"foo\":\"moo\",\"bar\":\"baz\"}", eventParameters.get());
assertFalse(server.eventsRemaining());
}
Aggregations