Search in sources :

Example 11 with EventPayload

use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.

the class ShortTermDuplicateMemoryTest method shouldForgetAboutRequestHashesAfterSomeTime.

@Test
public void shouldForgetAboutRequestHashesAfterSomeTime() throws IOException, InterruptedException {
    EventPayload payload;
    request(1);
    payload = server.waitForEvent();
    assertEquals(false, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
    request(0);
    payload = server.waitForEvent();
    assertEquals(false, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
    request(1);
    payload = server.waitForEvent();
    assertEquals(true, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
    request(2);
    payload = server.waitForEvent();
    assertEquals(false, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
    request(1);
    payload = server.waitForEvent();
    assertEquals(false, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
}
Also used : EventPayload(io.divolte.server.ServerTestUtils.EventPayload) Test(org.junit.Test)

Example 12 with EventPayload

use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.

the class ShortTermDuplicateMemoryTest method shouldFlagDuplicateRequests.

@Test
public void shouldFlagDuplicateRequests() throws IOException, InterruptedException {
    EventPayload payload;
    request(0);
    payload = server.waitForEvent();
    assertEquals(false, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
    request(1);
    payload = server.waitForEvent();
    assertEquals(false, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
    request(0);
    payload = server.waitForEvent();
    assertEquals(true, payload.event.exchange.getAttachment(DUPLICATE_EVENT_KEY));
}
Also used : EventPayload(io.divolte.server.ServerTestUtils.EventPayload) Test(org.junit.Test)

Example 13 with EventPayload

use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.

the class DslRecordMapperTest method shouldStopOnCondition.

@Test
public void shouldStopOnCondition() throws IOException, InterruptedException {
    setupServer("shorthand-conditional-stop.groovy");
    final EventPayload event = request("http://www.example.com");
    assertEquals("happened", event.record.get("client"));
    assertNull(event.record.get("session"));
}
Also used : EventPayload(io.divolte.server.ServerTestUtils.EventPayload) Test(org.junit.Test)

Example 14 with EventPayload

use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.

the class DslRecordMapperTest method shouldStopOnConditionClosureSyntax.

@Test
public void shouldStopOnConditionClosureSyntax() throws IOException, InterruptedException {
    setupServer("shorthand-conditional-stop-closure.groovy");
    final EventPayload event = request("http://www.example.com");
    assertEquals("happened", event.record.get("client"));
    assertNull(event.record.get("session"));
}
Also used : EventPayload(io.divolte.server.ServerTestUtils.EventPayload) Test(org.junit.Test)

Example 15 with EventPayload

use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.

the class DslRecordMapperTest method shouldMapLiteralsOntoCorrectTypes.

@Test
public void shouldMapLiteralsOntoCorrectTypes() throws IOException, InterruptedException {
    setupServer("correct-types-literal.groovy");
    final EventPayload event = request("http://www.example.com/correct");
    assertEquals("string value", event.record.get("queryparam"));
    assertEquals(true, event.record.get("queryparamBoolean"));
    assertEquals(42L, event.record.get("queryparamLong"));
    assertEquals(42, event.record.get("pathInteger"));
    assertEquals(42.0, event.record.get("queryparamDouble"));
}
Also used : EventPayload(io.divolte.server.ServerTestUtils.EventPayload) Test(org.junit.Test)

Aggregations

EventPayload (io.divolte.server.ServerTestUtils.EventPayload)46 Test (org.junit.Test)46 HttpURLConnection (java.net.HttpURLConnection)5 URL (java.net.URL)5 GenericRecord (org.apache.avro.generic.GenericRecord)3 Utf8 (org.apache.avro.util.Utf8)3 JsonParser (com.fasterxml.jackson.core.JsonParser)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 CityResponse (com.maxmind.geoip2.model.CityResponse)2 Config (com.typesafe.config.Config)2 ValidatedConfiguration (io.divolte.server.config.ValidatedConfiguration)2 LookupService (io.divolte.server.ip2geo.LookupService)2 DslRecordMapper (io.divolte.server.recordmapping.DslRecordMapper)2 Instant (java.time.Instant)2 Optional (java.util.Optional)2 Stream (java.util.stream.Stream)2 ParametersAreNonnullByDefault (javax.annotation.ParametersAreNonnullByDefault)2 Assert (org.junit.Assert)2 WebElement (org.openqa.selenium.WebElement)2 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)2