use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class GroupingTestWithModel method digest.
// grab the relevant stuff from the events and do some formatting
private List<String> digest(List<List<EventBase>> in) {
List<String> stringList = new ArrayList<>();
for (List<EventBase> list : in) {
StringBuilder builder = new StringBuilder();
for (EventBase eb : list) {
for (Object field : eb.getFields()) {
FieldBase fieldBase = (FieldBase) field;
builder.append(fieldBase.getName());
builder.append(':');
builder.append(fieldBase.getTypedValue().getValue());
builder.append(',');
}
}
stringList.add(builder.toString() + '\n');
}
return stringList;
}
use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class GroupingTest method testGroupingWithReducedResponse.
@Test
public void testGroupingWithReducedResponse() throws Exception {
Map<String, String> extraParameters = new HashMap<>();
Date startDate = format.parse("20091231");
Date endDate = format.parse("20150101");
String queryString = "UUID =~ '^[CS].*'";
Map<String, Integer> expectedMap = ImmutableMap.of("MALE", 10, "FEMALE", 2);
extraParameters.put("reduced.response", "true");
extraParameters.put("group.fields", "GENDER");
extraParameters.put("group.fields.batch.size", "0");
for (RebuildingScannerTestHelper.TEARDOWN teardown : TEARDOWNS) {
for (RebuildingScannerTestHelper.INTERRUPT interrupt : INTERRUPTS) {
EventQueryResponseBase response = (EventQueryResponseBase) runTestQueryWithGrouping(expectedMap, queryString, startDate, endDate, extraParameters, teardown, interrupt);
for (EventBase event : response.getEvents()) {
// The event should have a collapsed columnVisibility
String actualCV = event.getMarkings().get(COLVIS_MARKING).toString();
Assert.assertEquals(EXPECTED_COLVIS, actualCV);
// The fields should have no columnVisibility
for (Object f : event.getFields()) {
FieldBase<?> field = (FieldBase<?>) f;
Assert.assertNull(field.getMarkings().get(COLVIS_MARKING));
}
}
}
}
}
use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class GroupingTest method digest.
// grab the relevant stuff from the events and do some formatting
private List<String> digest(List<List<EventBase>> in) {
List<String> stringList = new ArrayList<>();
for (List<EventBase> list : in) {
StringBuilder builder = new StringBuilder();
for (EventBase eb : list) {
for (Object field : eb.getFields()) {
FieldBase fieldBase = (FieldBase) field;
builder.append(fieldBase.getName());
builder.append(':');
builder.append(fieldBase.getTypedValue().getValue());
builder.append(',');
}
}
stringList.add(builder.toString() + '\n');
}
return stringList;
}
Aggregations