use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class DslRecordMapperTest method shouldExitFromSectionOnCondition.
@Test
public void shouldExitFromSectionOnCondition() throws IOException, InterruptedException {
setupServer("nested-conditional-exit.groovy");
final EventPayload event = request("http://www.example.com");
assertEquals("happened", event.record.get("client"));
assertEquals("happened", event.record.get("pageview"));
assertEquals("happened", event.record.get("event"));
assertEquals("happened", event.record.get("customCookie"));
assertNull(event.record.get("session"));
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class DslRecordMapperTest method shouldApplyBooleanLogic.
@Test
public void shouldApplyBooleanLogic() throws IOException, InterruptedException {
setupServer("boolean-logic.groovy");
final EventPayload event = request("http://www.example.com/");
assertTrue((Boolean) event.record.get("unreliable"));
assertFalse((Boolean) event.record.get("dupe"));
assertTrue((Boolean) event.record.get("queryparamBoolean"));
assertTrue((Boolean) event.record.get("pathBoolean"));
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class DslRecordMapperTest method shouldSetCustomEventParameters.
@Test
public void shouldSetCustomEventParameters() throws IOException, InterruptedException {
setupServer("event-param-mapping.groovy");
final EventPayload event = request("http://www.example.com/", Collections.singletonList(HOMOGENOUS_EVENT_PARAMS));
assertEquals(ImmutableMap.of("foo", "string", "bar", "42"), event.record.get("paramMap"));
assertEquals("string", event.record.get("paramValue"));
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class DslRecordMapperTest method shouldChainValueProducersWithIntermediateNull.
@Test
public void shouldChainValueProducersWithIntermediateNull() throws IOException, InterruptedException {
setupServer("chained-na-mapping.groovy");
final EventPayload event = request("http://www.exmaple.com/");
assertEquals(new Utf8("not set"), event.record.get("queryparam"));
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class DslRecordMapperTest method shouldParseMinimalUri.
@Test
public void shouldParseMinimalUri() throws IOException, InterruptedException {
/*
* Test that URI parsing works on URIs that consist of only a path and possibly a query string.
* This is typical for Angular style applications, where the fragment component of the location
* is the internal location used within the angular app. In the mapping it should be possible
* to parse the fragment of the location to a URI again and do path matching and such against
* it.
*/
setupServer("uri-mapping-fragment.groovy");
final EventPayload event = request("http://example.com/path/?q=divolte#/client/side/path?x=value&y=42&q=multiple+words+%24%23%25%26");
assertEquals("/client/side/path", event.record.get("uriPath"));
assertEquals("x=value&y=42&q=multiple+words+%24%23%25%26", event.record.get("uriQueryString"));
assertEquals("multiple words $#%&", event.record.get("uriQueryStringValue"));
}
Aggregations