@Test public void testValidProperties() throws Exception { String aggregationGroup = "byUser:user"; String measurement = "count:COUNTER"; CubeSinkConfig cubeSinkConfig = new CubeSinkConfig("test_cube", "1", aggregationGroup, null, null, measurement); BatchCubeSink cubeSink = new BatchCubeSink(cubeSinkConfig); cubeSink.getProperties(); }
@VisibleForTesting @Override protected Map<String, String> getProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(config.getProperties().getProperties()); if (!Strings.isNullOrEmpty(config.getAggregations())) { properties.remove(Properties.Cube.AGGREGATIONS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.AGGREGATIONS, config.getAggregations(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return "dataset.cube.aggregation." + input + ".dimensions"; } })); } if (!Strings.isNullOrEmpty(config.getMeasurements())) { properties.remove(Properties.Cube.MEASUREMENTS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.MEASUREMENTS, config.getMeasurements(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return Properties.Cube.MEASUREMENT_PREFIX + input; } })); } properties.put(Properties.BatchReadableWritable.NAME, config.getName()); properties.put(Properties.BatchReadableWritable.TYPE, Cube.class.getName()); return properties; }
BatchCubeSink extends BatchWritableSink<StructuredRecord, byte[], CubeFact> { @VisibleForTesting @Override protected Map<String, String> getProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(config.getProperties().getProperties()); if (!Strings.isNullOrEmpty(config.getAggregations())) { properties.remove(Properties.Cube.AGGREGATIONS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.AGGREGATIONS, config.getAggregations(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return "dataset.cube.aggregation." + input + ".dimensions"; } })); } if (!Strings.isNullOrEmpty(config.getMeasurements())) { properties.remove(Properties.Cube.MEASUREMENTS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.MEASUREMENTS, config.getMeasurements(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return Properties.Cube.MEASUREMENT_PREFIX + input; } })); } properties.put(Properties.BatchReadableWritable.NAME, config.getName()); properties.put(Properties.BatchReadableWritable.TYPE, Cube.class.getName()); return properties; } }
BatchCubeSink extends BatchWritableSink<StructuredRecord, byte[], CubeFact> { @VisibleForTesting @Override protected Map<String, String> getProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(config.getProperties().getProperties()); if (!Strings.isNullOrEmpty(config.getAggregations())) { properties.remove(Properties.Cube.AGGREGATIONS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.AGGREGATIONS, config.getAggregations(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return "dataset.cube.aggregation." + input + ".dimensions"; } })); } if (!Strings.isNullOrEmpty(config.getMeasurements())) { properties.remove(Properties.Cube.MEASUREMENTS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.MEASUREMENTS, config.getMeasurements(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return Properties.Cube.MEASUREMENT_PREFIX + input; } })); } properties.put(Properties.BatchReadableWritable.NAME, config.getName()); properties.put(Properties.BatchReadableWritable.TYPE, Cube.class.getName()); return properties; } BatchCubeSink(CubeSinkConfig config); }
BatchCubeSink extends BatchWritableSink<StructuredRecord, byte[], CubeFact> { @VisibleForTesting @Override protected Map<String, String> getProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(config.getProperties().getProperties()); if (!Strings.isNullOrEmpty(config.getAggregations())) { properties.remove(Properties.Cube.AGGREGATIONS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.AGGREGATIONS, config.getAggregations(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return "dataset.cube.aggregation." + input + ".dimensions"; } })); } if (!Strings.isNullOrEmpty(config.getMeasurements())) { properties.remove(Properties.Cube.MEASUREMENTS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.MEASUREMENTS, config.getMeasurements(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return Properties.Cube.MEASUREMENT_PREFIX + input; } })); } properties.put(Properties.BatchReadableWritable.NAME, config.getName()); properties.put(Properties.BatchReadableWritable.TYPE, Cube.class.getName()); return properties; } BatchCubeSink(CubeSinkConfig config); @Override void initialize(BatchRuntimeContext context); @Override void transform(StructuredRecord input, Emitter<KeyValue<byte[], CubeFact>> emitter); }
BatchCubeSink extends BatchWritableSink<StructuredRecord, byte[], CubeFact> { @VisibleForTesting @Override protected Map<String, String> getProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(config.getProperties().getProperties()); if (!Strings.isNullOrEmpty(config.getAggregations())) { properties.remove(Properties.Cube.AGGREGATIONS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.AGGREGATIONS, config.getAggregations(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return "dataset.cube.aggregation." + input + ".dimensions"; } })); } if (!Strings.isNullOrEmpty(config.getMeasurements())) { properties.remove(Properties.Cube.MEASUREMENTS); properties.putAll(CubeUtils.parseAndGetProperties(Properties.Cube.MEASUREMENTS, config.getMeasurements(), ";", ":", new Function<String, String>() { @Override public String apply(String input) { return Properties.Cube.MEASUREMENT_PREFIX + input; } })); } properties.put(Properties.BatchReadableWritable.NAME, config.getName()); properties.put(Properties.BatchReadableWritable.TYPE, Cube.class.getName()); return properties; } BatchCubeSink(CubeSinkConfig config); @Override void initialize(BatchRuntimeContext context); @Override void transform(StructuredRecord input, Emitter<KeyValue<byte[], CubeFact>> emitter);  }