StellarServiceImpl implements StellarService { @Override public Map<String, Object> applyTransformations(SensorParserContext sensorParserContext) { JSONObject sampleJson = new JSONObject(sensorParserContext.getSampleData()); sensorParserContext.getSensorParserConfig().getFieldTransformations().forEach(fieldTransformer -> { fieldTransformer.transformAndUpdate(sampleJson, Context.EMPTY_CONTEXT(), sensorParserContext.getSensorParserConfig().getParserConfig()); } ); return sampleJson; } @Autowired  StellarServiceImpl(CuratorFramework client); @Override Map<String, Boolean> validateRules(List<String> rules); @Override Map<String, Object> applyTransformations(SensorParserContext sensorParserContext); @Override FieldTransformations[] getTransformations(); @Override List<StellarFunctionDescription> getStellarFunctions(); @Override List<StellarFunctionDescription> getSimpleStellarFunctions();  }
@Test public void applyTransformationsShouldProperlyTransformData() { SensorParserConfig sensorParserConfig = new SensorParserConfig(); FieldTransformer fieldTransformater = new FieldTransformer(); fieldTransformater.setOutput("url_host"); fieldTransformater.setTransformation("STELLAR"); fieldTransformater.setConfig(new LinkedHashMap<String, Object>() {{ put("url_host", "TO_LOWER(URL_TO_HOST(url))"); }}); sensorParserConfig.setFieldTransformations(ImmutableList.of(fieldTransformater)); SensorParserContext sensorParserContext = new SensorParserContext(); sensorParserContext.setSensorParserConfig(sensorParserConfig); sensorParserContext.setSampleData(new HashMap<String, Object>() {{ put("url", "https: }}); Map<String, Object> results = stellarService.applyTransformations(sensorParserContext); assertEquals(2, results.size()); assertEquals("https: assertEquals("caseystella.com", results.get("url_host")); }