DimensionalConfigurationSchema { public List<Map<String, Set<String>>> getDimensionsDescriptorIDToValueToOTFAggregator() { return dimensionsDescriptorIDToValueToOTFAggregator; } private  DimensionalConfigurationSchema();  DimensionalConfigurationSchema(List<Key> keys,
      List<Value> values,
      List<TimeBucket> timeBuckets,
      List<DimensionsCombination> dimensionsCombinations,
      AggregatorRegistry aggregatorRegistry);  DimensionalConfigurationSchema(String json,
      AggregatorRegistry aggregatorRegistry); AggregatorRegistry getAggregatorRegistry(); FieldsDescriptor getKeyDescriptor(); FieldsDescriptor getInputValuesDescriptor(); List<FieldsDescriptor> getDimensionsDescriptorIDToKeyDescriptor(); Map<DimensionsDescriptor, Integer> getDimensionsDescriptorToID(); List<DimensionsDescriptor> getDimensionsDescriptorIDToDimensionsDescriptor(); List<Map<String, Set<String>>> getDimensionsDescriptorIDToValueToAggregator(); String getKeysString(); String getBucketsString(); Map<String, List<Object>> getKeysToEnumValuesList(); List<Map<String, Set<String>>> getDimensionsDescriptorIDToValueToOTFAggregator(); List<Int2ObjectMap<FieldsDescriptor>> getDimensionsDescriptorIDToAggregatorIDToInputAggregatorDescriptor(); List<Int2ObjectMap<FieldsDescriptor>> getDimensionsDescriptorIDToAggregatorIDToOutputAggregatorDescriptor(); List<IntArrayList> getDimensionsDescriptorIDToIncrementalAggregatorIDs(); List<IntArrayList> getDimensionsDescriptorIDToAggregatorIDs(); List<IntArrayList> getDimensionsDescriptorIDToCompositeAggregatorIDs(); List<Fields> getDimensionsDescriptorIDToKeys(); List<Map<String, Set<String>>> getDimensionsDescriptorIDToFieldToAggregatorAdditionalValues(); Map<String, Map<String, Type>> getSchemaAllValueToAggregatorToType(); @Deprecated List<TimeBucket> getTimeBuckets(); List<CustomTimeBucket> getCustomTimeBuckets(); CustomTimeBucketRegistry getCustomTimeBucketRegistry(); @VisibleForTesting List<Map<String, FieldsDescriptor>> getDimensionsDescriptorIDToAggregatorToAggregateDescriptor(); @VisibleForTesting List<Map<String, FieldsDescriptor>> getDimensionsDescriptorIDToOTFAggregatorToAggregateDescriptor(); @VisibleForTesting List<Map<String, FieldsDescriptor>> getDimensionsDescriptorIDToCompositeAggregatorToAggregateDescriptor(); @Override int hashCode(); @Override boolean equals(Object obj); FieldsDescriptor getKeyDescriptorWithTime(); void setKeyDescriptorWithTime(FieldsDescriptor keyDescriptorWithTime); Map<String, List<String>> getKeyToTags(); Map<String, List<String>> getValueToTags(); List<String> getTags(); Map<String, String> getKeyToExpression(); Map<String, String> getValueToExpression(); static final int STARTING_TIMEBUCKET_ID; static final String ADDITIONAL_VALUE_SEPERATOR; static final int ADDITIONAL_VALUE_NUM_COMPONENTS; static final int ADDITIONAL_VALUE_VALUE_INDEX; static final int ADDITIONAL_VALUE_AGGREGATOR_INDEX; static final String FIELD_KEYS; static final String FIELD_KEYS_NAME; static final String FIELD_KEYS_TYPE; static final String FIELD_KEYS_EXPRESSION; static final String FIELD_KEYS_ENUMVALUES; static final List<Fields> VALID_KEY_FIELDS; static final String FIELD_TIME_BUCKETS; static final String FIELD_VALUES; static final String FIELD_VALUES_NAME; static final String FIELD_VALUES_TYPE; static final String FIELD_VALUES_EXPRESSION; static final String FIELD_VALUES_AGGREGATIONS; static final String FIELD_VALUES_AGGREGATOR; static final String PROPERTY_NAME_EMBEDED_AGGREGATOR; static final String PROPERTY_NAME_COUNT; static final String PROPERTY_NAME_SUB_COMBINATIONS; static final String FIELD_DIMENSIONS; static final String FIELD_DIMENSIONS_ALL_COMBINATIONS; static final String FIELD_DIMENSIONS_COMBINATIONS; static final String FIELD_DIMENSIONS_ADDITIONAL_VALUES; static final String FIELD_DIMENSIONS_TIME_BUCKETS; }
@Test public void testConstructorAgreement() { DimensionalConfigurationSchema expectedEventSchema = new DimensionalConfigurationSchema( SchemaUtils.jarResourceFileToString("adsGenericEventSchemaAdditional.json"), AggregatorRegistry.DEFAULT_AGGREGATOR_REGISTRY); @SuppressWarnings("unchecked") List<Object> publisherEnumVals = (List<Object>)((List)Lists.newArrayList("twitter", "facebook", "yahoo", "google", "bing", "amazon")); @SuppressWarnings("unchecked") List<Object> advertiserEnumVals = (List<Object>)((List)Lists.newArrayList("starbucks", "safeway", "mcdonalds", "macys", "taco bell", "walmart", "khol's", "san diego zoo", "pandas", "jack in the box", "tomatina", "ron swanson")); @SuppressWarnings("unchecked") List<Object> locationEnumVals = (List<Object>)((List)Lists.newArrayList("N", "LREC", "SKY", "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID")); List<Key> keys = Lists.newArrayList(new Key("publisher", Type.STRING, publisherEnumVals), new Key("advertiser", Type.STRING, advertiserEnumVals), new Key("location", Type.STRING, locationEnumVals)); List<TimeBucket> timeBuckets = Lists.newArrayList(TimeBucket.MINUTE, TimeBucket.HOUR, TimeBucket.DAY); List<Value> values = Lists.newArrayList(new Value("impressions", Type.LONG, Sets.newHashSet("SUM", "COUNT")), new Value("clicks", Type.LONG, Sets.newHashSet("SUM", "COUNT")), new Value("cost", Type.DOUBLE, Sets.newHashSet("SUM", "COUNT")), new Value("revenue", Type.DOUBLE, Sets.newHashSet("SUM", "COUNT"))); Map<String, Set<String>> valueToAggregators = Maps.newHashMap(); valueToAggregators.put("impressions", Sets.newHashSet("MIN", "MAX")); valueToAggregators.put("clicks", Sets.newHashSet("MIN", "MAX")); valueToAggregators.put("cost", Sets.newHashSet("MIN", "MAX")); valueToAggregators.put("revenue", Sets.newHashSet("MIN", "MAX")); Set<String> emptySet = Sets.newHashSet(); Map<String, Set<String>> emptyMap = Maps.newHashMap(); List<DimensionsCombination> dimensionsCombinations = Lists.newArrayList( new DimensionsCombination(new Fields(emptySet), emptyMap), new DimensionsCombination(new Fields(Sets.newHashSet("location")), emptyMap), new DimensionsCombination(new Fields(Sets.newHashSet("advertiser")), valueToAggregators), new DimensionsCombination(new Fields(Sets.newHashSet("publisher")), valueToAggregators), new DimensionsCombination(new Fields(Sets.newHashSet("advertiser", "location")), emptyMap), new DimensionsCombination(new Fields(Sets.newHashSet("publisher", "location")), emptyMap), new DimensionsCombination(new Fields(Sets.newHashSet("publisher", "advertiser")), emptyMap), new DimensionsCombination(new Fields(Sets.newHashSet("publisher", "advertiser", "location")), emptyMap)); DimensionalConfigurationSchema eventSchema = new DimensionalConfigurationSchema(keys, values, timeBuckets, dimensionsCombinations, AggregatorRegistry.DEFAULT_AGGREGATOR_REGISTRY); logger.debug("expected {}", expectedEventSchema.getDimensionsDescriptorIDToValueToOTFAggregator()); logger.debug("actual {}", eventSchema.getDimensionsDescriptorIDToValueToOTFAggregator()); Assert.assertEquals(expectedEventSchema, eventSchema); }