use of com.nextdoor.bender.InternalEvent in project bender by Nextdoor.
the class GelfOperationTest method testFlattenPrefix.
@Test
public void testFlattenPrefix() throws JsonSyntaxException, UnsupportedEncodingException, IOException {
JsonParser parser = new JsonParser();
JsonElement input = parser.parse(getResourceString("flatten_prefixed_input.json"));
String expectedOutput = getResourceString("flatten_prefixed_output.json");
DummpyEvent devent = new DummpyEvent();
devent.payload = input.getAsJsonObject();
GelfOperation op = new GelfOperation(new ArrayList<>());
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
op.perform(ievent);
assertEquals(parser.parse(expectedOutput), input);
}
use of com.nextdoor.bender.InternalEvent in project bender by Nextdoor.
the class GeoIpOperationTest method testUnkownIpRequired.
@Test(expected = AddressNotFoundException.class)
public void testUnkownIpRequired() throws Throwable {
GeoIpOperation op = setup(Arrays.asList(GeoProperty.LOCATION), true);
DummpyEvent devent = new DummpyEvent();
devent.setField("ip_address", "10.0.0.1");
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
try {
op.perform(ievent);
} catch (OperationException e) {
throw e.getCause();
}
}
use of com.nextdoor.bender.InternalEvent in project bender by Nextdoor.
the class GeoIpOperationTest method testInvalidIp.
@Test
public void testInvalidIp() throws Throwable {
GeoIpOperation op = setup(Arrays.asList(GeoProperty.LOCATION), false);
DummpyEvent devent = new DummpyEvent();
devent.setField("ip_address", "noanip");
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
op.perform(ievent);
}
use of com.nextdoor.bender.InternalEvent in project bender by Nextdoor.
the class GeoIpOperationTest method testNullIpRequired.
@Test(expected = OperationException.class)
public void testNullIpRequired() throws Throwable {
GeoIpOperation op = setup(Arrays.asList(GeoProperty.LOCATION), true);
DummpyEvent devent = new DummpyEvent();
devent.setField("ip_address", null);
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
op.perform(ievent);
}
use of com.nextdoor.bender.InternalEvent in project bender by Nextdoor.
the class GeoIpOperationTest method testNullIp.
@Test
public void testNullIp() throws Throwable {
GeoIpOperation op = setup(Arrays.asList(GeoProperty.LOCATION), false);
DummpyEvent devent = new DummpyEvent();
devent.setField("ip_address", null);
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
op.perform(ievent);
}
Aggregations