From 2c997f06dc856d0ffc66180f915c685b68fd1505 Mon Sep 17 00:00:00 2001 From: Philipp Zehnder Date: Thu, 29 Aug 2024 09:30:19 +0200 Subject: [PATCH] feat(#3179): new processor sensorlimitalert (#3180) * feat(#3179): Add processor suffix to QualityControlLimitsEnrichmentProcessor * feat(#3179): Add processor sensor limit alert * feat(#3180): Change to interface IStreamPipesDataProcessor --- .../jvm/EnricherExtensionModuleExport.java | 6 +- .../SensorLimitAlertProcessor.java | 173 ++++++++++++++++++ ...lityControlLimitsEnrichmentProcessor.java} | 2 +- .../documentation.md | 107 +++++++++++ .../icon.png | Bin 0 -> 19784 bytes .../strings.en | 40 ++++ .../SensorLimitAlertProcessorTest.java | 141 ++++++++++++++ .../QualityControlLimitsEnrichmentTest.java | 18 +- 8 files changed, 475 insertions(+), 12 deletions(-) create mode 100644 streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessor.java rename streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/{QualityControlLimitsEnrichment.java => QualityControlLimitsEnrichmentProcessor.java} (98%) create mode 100644 streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/documentation.md create mode 100644 streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/icon.png create mode 100644 streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/strings.en create mode 100644 streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessorTest.java diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/EnricherExtensionModuleExport.java b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/EnricherExtensionModuleExport.java index 1c8fea88fb..f26795f7ac 100644 --- a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/EnricherExtensionModuleExport.java +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/EnricherExtensionModuleExport.java @@ -23,7 +23,8 @@ import org.apache.streampipes.extensions.api.migration.IModelMigrator; import org.apache.streampipes.extensions.api.pe.IStreamPipesPipelineElement; import org.apache.streampipes.processors.enricher.jvm.processor.jseval.JSEvalProcessor; -import org.apache.streampipes.processors.enricher.jvm.processor.limitsenrichment.QualityControlLimitsEnrichment; +import org.apache.streampipes.processors.enricher.jvm.processor.limitsalert.SensorLimitAlertProcessor; +import org.apache.streampipes.processors.enricher.jvm.processor.limitsenrichment.QualityControlLimitsEnrichmentProcessor; import org.apache.streampipes.processors.enricher.jvm.processor.math.MathOpProcessor; import org.apache.streampipes.processors.enricher.jvm.processor.math.staticmathop.StaticMathOpProcessor; import org.apache.streampipes.processors.enricher.jvm.processor.trigonometry.TrigonometryProcessor; @@ -42,7 +43,8 @@ public List adapters() { public List> pipelineElements() { return List.of( new JSEvalProcessor(), - new QualityControlLimitsEnrichment(), + new QualityControlLimitsEnrichmentProcessor(), + new SensorLimitAlertProcessor(), new MathOpProcessor(), new StaticMathOpProcessor(), new TrigonometryProcessor(), diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessor.java b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessor.java new file mode 100644 index 0000000000..ddfdddf565 --- /dev/null +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessor.java @@ -0,0 +1,173 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.streampipes.processors.enricher.jvm.processor.limitsalert; + +import org.apache.streampipes.extensions.api.pe.IStreamPipesDataProcessor; +import org.apache.streampipes.extensions.api.pe.config.IDataProcessorConfiguration; +import org.apache.streampipes.extensions.api.pe.context.EventProcessorRuntimeContext; +import org.apache.streampipes.extensions.api.pe.param.IDataProcessorParameters; +import org.apache.streampipes.extensions.api.pe.routing.SpOutputCollector; +import org.apache.streampipes.model.DataProcessorType; +import org.apache.streampipes.model.extensions.ExtensionAssetType; +import org.apache.streampipes.model.runtime.Event; +import org.apache.streampipes.model.schema.PropertyScope; +import org.apache.streampipes.sdk.builder.ProcessingElementBuilder; +import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder; +import org.apache.streampipes.sdk.builder.processor.DataProcessorConfiguration; +import org.apache.streampipes.sdk.helpers.EpProperties; +import org.apache.streampipes.sdk.helpers.EpRequirements; +import org.apache.streampipes.sdk.helpers.Labels; +import org.apache.streampipes.sdk.helpers.Locales; +import org.apache.streampipes.sdk.helpers.OutputStrategies; +import org.apache.streampipes.vocabulary.SO; + +public class SensorLimitAlertProcessor implements IStreamPipesDataProcessor { + + protected static final String SENSOR_VALUE_LABEL = "sensorValue"; + protected static final String UPPER_CONTROL_LIMIT_LABEL = "upperControlLimit"; + protected static final String UPPER_WARNING_LIMIT_LABEL = "upperWarningLimit"; + protected static final String LOWER_WARNING_LIMIT_LABEL = "lowerWarningLimit"; + protected static final String LOWER_CONTROL_LIMIT_LABEL = "lowerControlLimit"; + + // Property names that are appended to the resulting event + protected static final String ALERT_STATUS = "alertStatus"; + protected static final String LIMIT_BREACHED = "limitBreached"; + + protected static final String ALERT = "ALERT"; + protected static final String WARNING = "WARNING"; + protected static final String UPPER_LIMIT = "UPPER_LIMIT"; + protected static final String LOWER_LIMIT = "LOWER_LIMIT"; + + private String sensorField; + private String upperControlLimitField; + private String upperWarningLimitField; + private String lowerWarningLimitField; + private String lowerControlLimitField; + + + @Override + public IDataProcessorConfiguration declareConfig() { + return DataProcessorConfiguration.create( + SensorLimitAlertProcessor::new, + ProcessingElementBuilder + .create("org.apache.streampipes.processors.enricher.jvm.processor.limitsalert", 0) + .category(DataProcessorType.ENRICH) + .withAssets(ExtensionAssetType.DOCUMENTATION, ExtensionAssetType.ICON) + .withLocales(Locales.EN) + .requiredStream(StreamRequirementsBuilder + .create() + .requiredPropertyWithUnaryMapping( + EpRequirements.numberReq(), + Labels.withId(SENSOR_VALUE_LABEL), + PropertyScope.MEASUREMENT_PROPERTY + ) + .requiredPropertyWithUnaryMapping( + EpRequirements.numberReq(), + Labels.withId(UPPER_CONTROL_LIMIT_LABEL), + PropertyScope.MEASUREMENT_PROPERTY + ) + .requiredPropertyWithUnaryMapping( + EpRequirements.numberReq(), + Labels.withId(UPPER_WARNING_LIMIT_LABEL), + PropertyScope.MEASUREMENT_PROPERTY + ) + .requiredPropertyWithUnaryMapping( + EpRequirements.numberReq(), + Labels.withId(LOWER_WARNING_LIMIT_LABEL), + PropertyScope.MEASUREMENT_PROPERTY + ) + .requiredPropertyWithUnaryMapping( + EpRequirements.numberReq(), + Labels.withId(LOWER_CONTROL_LIMIT_LABEL), + PropertyScope.MEASUREMENT_PROPERTY + ) + .build()) + .outputStrategy( + OutputStrategies.append( + EpProperties.stringEp(Labels.empty(), ALERT_STATUS, SO.TEXT), + EpProperties.stringEp(Labels.empty(), LIMIT_BREACHED, SO.TEXT) + )) + .build() + ); + } + + @Override + public void onPipelineStarted( + IDataProcessorParameters params, + SpOutputCollector collector, + EventProcessorRuntimeContext runtimeContext + ) { + var extractor = params.extractor(); + + sensorField = extractor.mappingPropertyValue(SENSOR_VALUE_LABEL); + upperControlLimitField = extractor.mappingPropertyValue(UPPER_CONTROL_LIMIT_LABEL); + upperWarningLimitField = extractor.mappingPropertyValue(UPPER_WARNING_LIMIT_LABEL); + lowerWarningLimitField = extractor.mappingPropertyValue(LOWER_WARNING_LIMIT_LABEL); + lowerControlLimitField = extractor.mappingPropertyValue(LOWER_CONTROL_LIMIT_LABEL); + } + + @Override + public void onEvent(Event event, SpOutputCollector collector) { + var sensorValue = event.getFieldBySelector(sensorField) + .getAsPrimitive() + .getAsDouble(); + var upperControlLimit = event.getFieldBySelector(upperControlLimitField) + .getAsPrimitive() + .getAsDouble(); + var upperWarningLimit = event.getFieldBySelector(upperWarningLimitField) + .getAsPrimitive() + .getAsDouble(); + var lowerWarningLimit = event.getFieldBySelector(lowerWarningLimitField) + .getAsPrimitive() + .getAsDouble(); + var lowerControlLimit = event.getFieldBySelector(lowerControlLimitField) + .getAsPrimitive() + .getAsDouble(); + + String alertStatus = null; + String limitBreached = null; + + if (sensorValue > upperControlLimit) { + alertStatus = ALERT; + limitBreached = UPPER_LIMIT; + } else if (sensorValue > upperWarningLimit) { + alertStatus = WARNING; + limitBreached = UPPER_LIMIT; + } else if (sensorValue < lowerControlLimit) { + alertStatus = ALERT; + limitBreached = LOWER_LIMIT; + } else if (sensorValue < lowerWarningLimit) { + alertStatus = WARNING; + limitBreached = LOWER_LIMIT; + } + + if (alertStatus != null && limitBreached != null) { + event.addField(ALERT_STATUS, alertStatus); + event.addField(LIMIT_BREACHED, limitBreached); + collector.collect(event); + } + + } + + @Override + public void onPipelineStopped() { + + } + +} diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichment.java b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentProcessor.java similarity index 98% rename from streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichment.java rename to streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentProcessor.java index 0262487428..f1601c59a7 100644 --- a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichment.java +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentProcessor.java @@ -36,7 +36,7 @@ import org.apache.streampipes.wrapper.params.compat.ProcessorParams; import org.apache.streampipes.wrapper.standalone.StreamPipesDataProcessor; -public class QualityControlLimitsEnrichment extends StreamPipesDataProcessor { +public class QualityControlLimitsEnrichmentProcessor extends StreamPipesDataProcessor { protected static final String UPPER_CONTROL_LIMIT_LABEL = "upperControlLimitInput"; diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/documentation.md b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/documentation.md new file mode 100644 index 0000000000..2f9d7b9672 --- /dev/null +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/documentation.md @@ -0,0 +1,107 @@ + + +## Sensor Limit Alert + +

+ +

+ +*** + +## Description + +The Sensor Limit Alert processor monitors sensor values in real-time and triggers alerts when these values exceed user-defined control or warning limits. This processor is useful in scenarios where continuous monitoring of critical parameters is required, and immediate action is needed when values go out of acceptable ranges. + +*** + +## Required Input + +This processor accepts any event stream containing sensor data. The events must include fields for sensor values and the corresponding upper and lower limits. + +*** + +## Configuration + +#### Sensor Value + +Select the sensor value to be monitored. This is the primary measurement that will be checked against the defined limits. + +#### Upper Control Limit + +Specify the upper control limit for the sensor. This value defines the maximum threshold, beyond which an alert is triggered. + +#### Upper Warning Limit + +Specify the upper warning limit for the sensor. This value indicates when the sensor value is approaching the upper control limit, triggering a warning. + +#### Lower Warning Limit + +Specify the lower warning limit for the sensor. This value indicates when the sensor value is approaching the lower control limit, triggering a warning. + +#### Lower Control Limit + +Specify the lower control limit for the sensor. This value defines the minimum threshold, below which an alert is triggered. + +*** + +## Output + +The processor emits events only when the sensor value exceeds the specified limits. The output event includes the original sensor data along with additional fields that indicate: +- **Alert Status**: Whether the sensor value breached a WARNING or control LIMIT. +- **Limit Breached**: Which specific limit was breached (e.g., "UPPER_CONTROL_LIMIT" or "LOWER_WARNING_LIMIT"). + +These output events can be used for triggering notifications or other actions in downstream processing. + +*** + +## Example + +### User Configuration +- Mapping fields for: + - **Sensor Value** + - **Upper Control Limit** + - **Upper Warning Limit** + - **Lower Warning Limit** + - **Lower Control Limit** + +### Input Event +``` +{ + "timestamp": 1627891234000, + "sensorValue": 105.0, + "upperControlLimit": 100.0, + "upperWarningLimit": 90.0, + "lowerWarningLimit": 10.0, + "lowerControlLimit": 0.0 +} +``` + +### Output Event +``` +{ + "timestamp": 1627891234000, + "sensorValue": 105.0, + "upperControlLimit": 100.0, + "upperWarningLimit": 90.0, + "lowerWarningLimit": 10.0, + "lowerControlLimit": 0.0, + "alertStatus": "ALERT", + "limitBreached": "UPPER_CONTROL_LIMIT" +} +``` \ No newline at end of file diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/icon.png b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c53a42a585d4a7cff592357cdd2ab38a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$NkX}h$2pU%?kA6>c z=SEW_|8J&vAWJHD_iI<$x5%6g)S&^7`E1QG@*WEn26+fU3X{4HpLx+#=_Bi9{B%1n zuZ4S%uXaGN@lgGd+QHEQ;5|MBIlhrA8W52ihmax?cW0mdJkObXIl#%0(53aX{e2$I zyx2GlVXo*L0g?_wSEJ9_wypoZ?r~jYJgKcGMkkCc5nDhcw|+XlIoS0ZN?=8vr+T4e z5e)>}6NtY&vmO>qTLO)39N^G(N;F6U! zo`A@1hgr&bFOOuh0^W6qbTnQbh8|~oRr$<{5+7f9lC&ifZ+!@~!z>B%LT zfF#)OPmt4qiza5pUL~Jw_SN8qfa^UL^79E=z}%(W;RAl|@2{jy08MFrDoZ{#?1g|P z`95$sN$xNdkh}lO6DXIjqh(P!iv%~=qyR)=8|U(*vq1c-5qoV;2{I^^aKnjYy(%ECKcg)O&bNaA? zm4(-R$UKhyGr0aB^E99Q*uTn<559RG7(bok`^8d!6ZzYqy`MKG1EvGKuvecM51N!z zh5%485XwCOTo~};ZzoHs4w^w4pyV$9pWzRjqW{;xN8;xr2JSJOwWw3bkle3W1!~%D zmR43KlObuK22@XN`AtFQxDT)mc7=9-U*qe3K(#jA;aG8u=RqB-8BeZ&68SeD&HyLP zWN~{I+@tv|UjOo94z&LsP}Y{hXf#>M838Nd{-54Kw?#I3R!4Uqv~S7ERrvaYpUAMP z)!3HrdHwq+Cq9?RYUJH>XTEm-fWtq33@oQ&n&ZB&whz{geK#&YrWbags2cmX;8MBn$zS%&jw_5zur+K{-FrKcbyI@yhiTM6qtchBfUoQ z^NN5Z|1Et06PbG+5i9m literal 0 HcmV?d00001 diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/strings.en b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/strings.en new file mode 100644 index 0000000000..f7f0c4449e --- /dev/null +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/main/resources/org.apache.streampipes.processors.enricher.jvm.processor.limitsalert/strings.en @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.apache.streampipes.processors.enricher.jvm.processor.limitsalert.title=Sensor Limit Alert +org.apache.streampipes.processors.enricher.jvm.processor.limitsalert.description=Monitors sensor values and triggers alerts when they exceed defined control or warning limits. + +sensorValue.title=Sensor Value +sensorValue.description=Select the sensor value to be monitored. + +upperControlLimit.title=Upper Control Limit +upperControlLimit.description=Set the upper control limit for the sensor value. + +upperWarningLimit.title=Upper Warning Limit +upperWarningLimit.description=Set the upper warning limit for the sensor value. + +lowerWarningLimit.title=Lower Warning Limit +lowerWarningLimit.description=Set the lower warning limit for the sensor value. + +lowerControlLimit.title=Lower Control Limit +lowerControlLimit.description=Set the lower control limit for the sensor value. + +alertStatus.title=Alert Status +alertStatus.description=Indicates whether the sensor value has breached a warning or control limit. + +limitBreached.title=Limit Breached +limitBreached.description=Specifies which limit (e.g., Upper Control Limit, Lower Warning Limit) was breached by the sensor value. \ No newline at end of file diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessorTest.java b/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessorTest.java new file mode 100644 index 0000000000..3741a11c3f --- /dev/null +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsalert/SensorLimitAlertProcessorTest.java @@ -0,0 +1,141 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.streampipes.processors.enricher.jvm.processor.limitsalert; + +import org.apache.streampipes.test.executors.ProcessingElementTestExecutor; +import org.apache.streampipes.test.executors.TestConfiguration; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +class SensorLimitAlertProcessorTest { + + private final String temperature = "temperature"; + private final String upperControlLimit = "upperControlLimit"; + private final String upperWarningLimit = "upperWarningLimit"; + private final String lowerWarningLimit = "lowerWarningLimit"; + private final String lowerControlLimit = "lowerControlLimit"; + + private final Map baseEvent = Map.of( + upperControlLimit, 90.0, + upperWarningLimit, 80.0, + lowerWarningLimit, 20.0, + lowerControlLimit, 10.0 + ); + + private SensorLimitAlertProcessor processor; + + @BeforeEach + public void setup() { + processor = new SensorLimitAlertProcessor(); + } + + static Stream arguments() { + return Stream.of( + Arguments.of( + 5.0, + SensorLimitAlertProcessor.ALERT, + SensorLimitAlertProcessor.LOWER_LIMIT + ), + Arguments.of( + 15.0, + SensorLimitAlertProcessor.WARNING, + SensorLimitAlertProcessor.LOWER_LIMIT + ), + Arguments.of( + 85.0, + SensorLimitAlertProcessor.WARNING, + SensorLimitAlertProcessor.UPPER_LIMIT + ), + Arguments.of( + 95.0, + SensorLimitAlertProcessor.ALERT, + SensorLimitAlertProcessor.UPPER_LIMIT + ) + ); + } + + @ParameterizedTest + @MethodSource("arguments") + void onEvent_differentAlertsTest( + double sensorValue, + String alertValue, + String limitBreachedValue + ) { + + List> inputEvents = List.of( + new HashMap<>(baseEvent) {{ + put(temperature, sensorValue); + }} + ); + + List> outputEvents = List.of( + new HashMap<>(baseEvent) {{ + put(temperature, sensorValue); + put(SensorLimitAlertProcessor.ALERT_STATUS, alertValue); + put(SensorLimitAlertProcessor.LIMIT_BREACHED, limitBreachedValue); + }} + ); + + var configuration = getTestConfiguration(); + + var testExecutor = new ProcessingElementTestExecutor(processor, configuration); + + testExecutor.run(inputEvents, outputEvents); + } + + @Test + void onEvent_noEventIsEmittedIfInValueRangeTest() { + + List> inputEvents = List.of( + new HashMap<>(baseEvent) {{ + put(temperature, 50.0); + }} + ); + + List> outputEvents = List.of(); + + var configuration = getTestConfiguration(); + + var testExecutor = new ProcessingElementTestExecutor(processor, configuration); + + testExecutor.run(inputEvents, outputEvents); + } + + private TestConfiguration getTestConfiguration() { + return TestConfiguration + .builder() + .configWithDefaultPrefix(SensorLimitAlertProcessor.SENSOR_VALUE_LABEL, temperature) + .configWithDefaultPrefix(SensorLimitAlertProcessor.UPPER_CONTROL_LIMIT_LABEL, upperControlLimit) + .configWithDefaultPrefix(SensorLimitAlertProcessor.UPPER_WARNING_LIMIT_LABEL, upperWarningLimit) + .configWithDefaultPrefix(SensorLimitAlertProcessor.LOWER_WARNING_LIMIT_LABEL, lowerWarningLimit) + .configWithDefaultPrefix(SensorLimitAlertProcessor.LOWER_CONTROL_LIMIT_LABEL, lowerControlLimit) + .build(); + + } + +} \ No newline at end of file diff --git a/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentTest.java b/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentTest.java index d0ae20828a..7e8ffb23a9 100644 --- a/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentTest.java +++ b/streampipes-extensions/streampipes-processors-enricher-jvm/src/test/java/org/apache/streampipes/processors/enricher/jvm/processor/limitsenrichment/QualityControlLimitsEnrichmentTest.java @@ -32,7 +32,7 @@ class QualityControlLimitsEnrichmentTest { @Test void onEvent() { - var processor = new QualityControlLimitsEnrichment(); + var processor = new QualityControlLimitsEnrichmentProcessor(); List> inputEvents = List.of(Map.of( "temperature", 10.1 @@ -40,18 +40,18 @@ void onEvent() { List> outputEvents = List.of(Map.of( "temperature", 10.1, - QualityControlLimitsEnrichment.UPPER_CONTROL_LIMIT, 80.0, - QualityControlLimitsEnrichment.UPPER_WARNING_LIMIT, 70.0, - QualityControlLimitsEnrichment.LOWER_CONTROL_LIMIT, 30.0, - QualityControlLimitsEnrichment.LOWER_WARNING_LIMIT, 20.0 + QualityControlLimitsEnrichmentProcessor.UPPER_CONTROL_LIMIT, 80.0, + QualityControlLimitsEnrichmentProcessor.UPPER_WARNING_LIMIT, 70.0, + QualityControlLimitsEnrichmentProcessor.LOWER_CONTROL_LIMIT, 30.0, + QualityControlLimitsEnrichmentProcessor.LOWER_WARNING_LIMIT, 20.0 )); var configuration = TestConfiguration .builder() - .config(QualityControlLimitsEnrichment.UPPER_CONTROL_LIMIT_LABEL, 80.0) - .config(QualityControlLimitsEnrichment.UPPER_WARNING_LIMIT_LABEL, 70.0) - .config(QualityControlLimitsEnrichment.LOWER_CONTROL_LIMIT_LABEL, 30.0) - .config(QualityControlLimitsEnrichment.LOWER_WARNING_LIMIT_LABEL, 20.0) + .config(QualityControlLimitsEnrichmentProcessor.UPPER_CONTROL_LIMIT_LABEL, 80.0) + .config(QualityControlLimitsEnrichmentProcessor.UPPER_WARNING_LIMIT_LABEL, 70.0) + .config(QualityControlLimitsEnrichmentProcessor.LOWER_CONTROL_LIMIT_LABEL, 30.0) + .config(QualityControlLimitsEnrichmentProcessor.LOWER_WARNING_LIMIT_LABEL, 20.0) .prefixStrategy(PrefixStrategy.SAME_PREFIX) .build();