use of com.yahoo.bullet.result.Meta.Concept in project bullet-core by yahoo.
the class BulletConfigTest method testIncompleteMetadata.
@Test
public void testIncompleteMetadata() {
List<Map<String, String>> metadata = new ArrayList<>();
Map<String, String> expected = new HashMap<>();
for (Concept concept : Arrays.asList(Concept.QUERY_ID, Concept.SKETCH_ITEMS_SEEN)) {
Map<String, String> entry = new HashMap<>();
String name = concept.getName();
String key = concept.getName().substring(0, 3);
entry.put(BulletConfig.RESULT_METADATA_METRICS_CONCEPT_KEY, name);
entry.put(BulletConfig.RESULT_METADATA_METRICS_NAME_KEY, key);
metadata.add(entry);
expected.put(name, key);
}
BulletConfig config = new BulletConfig();
config.set(BulletConfig.RESULT_METADATA_METRICS, metadata);
config.validate();
Assert.assertEquals(config.get(BulletConfig.RESULT_METADATA_METRICS), expected);
// Add only one entry
Map<String, String> entry = new HashMap<>();
entry.put(BulletConfig.RESULT_METADATA_METRICS_CONCEPT_KEY, Concept.QUERY_ID.getName());
metadata.add(entry);
config.set(BulletConfig.RESULT_METADATA_METRICS, metadata);
config.validate();
// Now it's all defaults
Assert.assertEquals(config.get(BulletConfig.RESULT_METADATA_METRICS), allMetadataAsMap());
}