use of datawave.data.type.LcType in project datawave by NationalSecurityAgency.
the class GroupingTest method testCountingMap.
@Test
public void testCountingMap() {
MarkingFunctions markingFunctions = new MarkingFunctions.Default();
GroupingTransform.GroupCountingHashMap map = new GroupingTransform.GroupCountingHashMap(markingFunctions);
GroupingTypeAttribute attr1 = new GroupingTypeAttribute(new LcType("FOO"), new Key("FOO"), true);
attr1.setColumnVisibility(new ColumnVisibility("A"));
map.add(Collections.singleton(attr1));
GroupingTypeAttribute attr2 = new GroupingTypeAttribute(new LcType("FOO"), new Key("FOO"), true);
attr2.setColumnVisibility(new ColumnVisibility("B"));
map.add(Collections.singleton(attr2));
GroupingTypeAttribute attr3 = new GroupingTypeAttribute(new LcType("BAR"), new Key("BAR"), true);
attr3.setColumnVisibility(new ColumnVisibility("C"));
map.add(Collections.singleton(attr3));
log.debug("map is: " + map);
for (Map.Entry<Collection<GroupingTypeAttribute<?>>, Integer> entry : map.entrySet()) {
// the first and only one
Attribute<?> attr = entry.getKey().iterator().next();
int count = entry.getValue();
if (attr.getData().toString().equals("FOO")) {
Assert.assertEquals(2, count);
Assert.assertEquals(new ColumnVisibility("A&B"), attr.getColumnVisibility());
} else if (attr.getData().toString().equals("BAR")) {
Assert.assertEquals(1, count);
Assert.assertEquals(new ColumnVisibility("C"), attr.getColumnVisibility());
}
}
}
use of datawave.data.type.LcType in project datawave by NationalSecurityAgency.
the class FetchDataTypesVisitorTest method testFunctionWithNormalizer.
@Test
public void testFunctionWithNormalizer() throws ParseException {
String query = "content:phrase(FOO2, termOffsetMap, 'bar', 'baz')";
Multimap<String, Type<?>> expected = HashMultimap.create();
expected.put("FOO2", new LcType());
runTest(query, expected);
}
use of datawave.data.type.LcType in project datawave by NationalSecurityAgency.
the class FetchDataTypesVisitorTest method setup.
@BeforeClass
public static void setup() {
// 1. Configure the ShardQueryConfig
config.setBeginDate(new Date(0));
config.setEndDate(new Date(System.currentTimeMillis()));
// 2. Configure the MockMetadataHelper
helper.addNormalizers("FOO", Sets.newHashSet(new LcNoDiacriticsType()));
helper.addNormalizers("FOO2", Sets.newHashSet(new LcType()));
helper.addNormalizers("FOO3", Sets.newHashSet(new NumberType()));
helper.addNormalizers("FOO4", Sets.newHashSet(new LcType(), new LcNoDiacriticsType()));
}
use of datawave.data.type.LcType in project datawave by NationalSecurityAgency.
the class FetchDataTypesVisitorTest method testRegexWithNormalizer.
@Test
public void testRegexWithNormalizer() throws ParseException {
String query = "filter:includeRegex(FOO2, 'bar.*')";
Multimap<String, Type<?>> expected = HashMultimap.create();
expected.put("FOO2", new LcType());
runTest(query, expected);
}
use of datawave.data.type.LcType in project datawave by NationalSecurityAgency.
the class FetchDataTypesVisitorTest method testTwoSingleTermNormalizers.
@Test
public void testTwoSingleTermNormalizers() throws ParseException {
String query = "FOO2 == 'bar' && FOO3 == '3'";
Multimap<String, Type<?>> expected = HashMultimap.create();
expected.put("FOO2", new LcType());
expected.put("FOO3", new NumberType());
runTest(query, expected);
}
Aggregations