100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Upgrade camel for urgent bug fix includes other minor improvements (#1238)
Rich Turner473e55dd331f
diff --git a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.javaindex ec104ca31..bb9d0c0e9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java@@ -36,10 +36,7 @@ import org.openremote.model.protocol.ProtocolAssetService;import org.openremote.model.protocol.ProtocolUtil;import org.openremote.model.util.Pair;-import java.util.Collections;-import java.util.HashSet;-import java.util.Map;-import java.util.Set;+import java.util.*;import java.util.concurrent.ConcurrentHashMap;import java.util.concurrent.ScheduledExecutorService;import java.util.concurrent.TimeUnit;@@ -162,7 +159,7 @@ public abstract class AbstractProtocol<T extends Agent<T, ?, U>, U extends AgentdoLinkedAttributeWrite(agent.getAgentLink(event), event, ignoreAndConverted.value);if (agent.isUpdateOnWrite().orElse(false) || agentLink.getUpdateOnWrite().orElse(false)) {- updateLinkedAttribute(new AttributeState(event.getRef(), ignoreAndConverted.value));+ updateLinkedAttribute(event.getRef(), ignoreAndConverted.value);}}}@@ -191,29 +188,29 @@ public abstract class AbstractProtocol<T extends Agent<T, ?, U>, U extends Agent@Override- final public void updateLinkedAttribute(final AttributeState state, long timestamp) {- Attribute<?> attribute = linkedAttributes.get(state.getRef());+ final public void updateLinkedAttribute(final AttributeRef attributeRef, final Object value, long timestamp) {+ Attribute<?> attribute = linkedAttributes.get(attributeRef);if (attribute == null) {- LOG.log(System.Logger.Level.WARNING, () -> "Update linked attribute called for un-linked attribute: " + state);+ LOG.log(System.Logger.Level.WARNING, () -> "Update linked attribute called for un-linked attribute: " + attributeRef);return;}- Pair<Boolean, Object> ignoreAndConverted = ProtocolUtil.doInboundValueProcessing(state.getRef().getId(), attribute, agent.getAgentLink(attribute), state.getValue().orElse(null));+ Pair<Boolean, Object> ignoreAndConverted = ProtocolUtil.doInboundValueProcessing(attributeRef.getId(), attribute, agent.getAgentLink(attribute), value);if (ignoreAndConverted.key) {- LOG.log(System.Logger.Level.DEBUG, "Value conversion returned ignore so attribute will not be updated: " + state.getRef());+ LOG.log(System.Logger.Level.DEBUG, "Value conversion returned ignore so attribute will not be updated: " + attributeRef);return;}- AttributeEvent attributeEvent = new AttributeEvent(new AttributeState(state.getRef(), ignoreAndConverted.value), timestamp);+ AttributeEvent attributeEvent = new AttributeEvent(attributeRef, ignoreAndConverted.value, timestamp);LOG.log(System.Logger.Level.TRACE, () -> "Sending linked attribute update: " + attributeEvent);assetService.sendAttributeEvent(attributeEvent);}@Override- final public void updateLinkedAttribute(final AttributeState state) {- updateLinkedAttribute(state, timerService.getCurrentTimeMillis());+ final public void updateLinkedAttribute(final AttributeRef attributeRef, final Object value) {+ updateLinkedAttribute(attributeRef, value, timerService.getCurrentTimeMillis());}@Overridediff --git a/agent/src/main/java/org/openremote/agent/protocol/bluetooth/mesh/BluetoothMeshProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/bluetooth/mesh/BluetoothMeshProtocol.javaindex dd8476be1..c9575532a 100644--- a/agent/src/main/java/org/openremote/agent/protocol/bluetooth/mesh/BluetoothMeshProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/bluetooth/mesh/BluetoothMeshProtocol.java@@ -29,7 +29,6 @@ import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.syslog.SyslogCategory;import java.nio.file.Path;@@ -286,7 +285,7 @@ public class BluetoothMeshProtocol extends AbstractProtocol<BluetoothMeshAgent,modelName + "', appKeyIndex: '" + appKeyIndex + "'] - " + attributeRef);Class<?> clazz = attribute.getTypeClass();- Consumer<Object> sensorValueConsumer = value -> updateLinkedAttribute(new AttributeState(attributeRef, toAttributeValue(value, clazz)));+ Consumer<Object> sensorValueConsumer = value -> updateLinkedAttribute(attributeRef, toAttributeValue(value, clazz));sensorValueConsumerMap.put(attributeRef, sensorValueConsumer);meshNetwork.addMeshModel(address, modelId, appKeyIndex);diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.javaindex 442ec868e..d101a5c1c 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java@@ -43,7 +43,6 @@ import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.auth.OAuthGrant;import org.openremote.model.auth.UsernamePassword;import org.openremote.model.syslog.SyslogCategory;@@ -575,14 +574,14 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {}if (attributeRef != null) {- updateLinkedAttribute(new AttributeState(attributeRef, value));+ updateLinkedAttribute(attributeRef, value);// Look for any attributes that also want to use this polling responsesynchronized (pollingLinkedAttributeMap) {Set<AttributeRef> linkedRefs = pollingLinkedAttributeMap.get(attributeRef);if (linkedRefs != null) {Object finalValue = value;- linkedRefs.forEach(ref -> updateLinkedAttribute(new AttributeState(ref, finalValue)));+ linkedRefs.forEach(ref -> updateLinkedAttribute(ref, finalValue));}}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.javaindex 75bf23184..845176b4d 100644--- a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java@@ -150,7 +150,7 @@ public class KNXProtocol extends AbstractProtocol<KNXAgent, KNXAgentLink> implemconnection.sendCommand(datapoint, event.getValue());// We assume KNX actuator will send new status on relevant status group address which will be picked up by listener and updates the state again later- updateLinkedAttribute(event.getState());+ updateLinkedAttribute(event.getRef(), event.getValue());}}@@ -182,7 +182,7 @@ public class KNXProtocol extends AbstractProtocol<KNXAgent, KNXAgentLink> implemprotected void handleKNXValueChange(AttributeRef attributeRef, Object value) {LOG.fine("KNX protocol received value '" + value + "' for : " + attributeRef);- updateLinkedAttribute(new AttributeState(attributeRef, value));+ updateLinkedAttribute(attributeRef, value);}protected void removeStatusDatapoint(AttributeRef attributeRef) {diff --git a/agent/src/main/java/org/openremote/agent/protocol/mail/AbstractMailProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/mail/AbstractMailProtocol.javaindex 1028572c5..c964f28df 100644--- a/agent/src/main/java/org/openremote/agent/protocol/mail/AbstractMailProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/mail/AbstractMailProtocol.java@@ -27,7 +27,6 @@ import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.auth.OAuthGrant;import org.openremote.model.auth.UsernamePassword;import org.openremote.model.mail.MailMessage;@@ -133,7 +132,7 @@ public abstract class AbstractMailProtocol<T extends AbstractMailAgent<T, U, V>,attributeMessageProcessorMap.forEach(((attributeRef, mailMessageStringFunction) -> {String value = mailMessageStringFunction.apply(mailMessage);if (value != null) {- updateLinkedAttribute(new AttributeState(attributeRef, value));+ updateLinkedAttribute(attributeRef, value);} else if (LOG.isLoggable(Level.FINEST)) {LOG.log(Level.FINEST, "MailMessage failed to match linked attribute:" + attributeRef + ", " + mailMessage);}diff --git a/agent/src/main/java/org/openremote/agent/protocol/mqtt/MQTTProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/mqtt/MQTTProtocol.javaindex be3da6f84..685971305 100644--- a/agent/src/main/java/org/openremote/agent/protocol/mqtt/MQTTProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/mqtt/MQTTProtocol.java@@ -24,7 +24,6 @@ import org.openremote.container.util.UniqueIdentifierGenerator;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.syslog.SyslogCategory;import org.openremote.model.util.ValueUtil;@@ -51,7 +50,7 @@ public class MQTTProtocol extends AbstractMQTTClientProtocol<MQTTProtocol, MQTTAprotected void doLinkAttribute(String assetId, Attribute<?> attribute, MQTTAgentLink agentLink) throws RuntimeException {agentLink.getSubscriptionTopic().ifPresent(topic -> {Consumer<MQTTMessage<String>> messageConsumer = msg -> updateLinkedAttribute(- new AttributeState(assetId, attribute.getName(), msg.payload)+ new AttributeRef(assetId, attribute.getName()), msg.payload);client.addMessageConsumer(topic, messageConsumer);protocolMessageConsumers.put(new AttributeRef(assetId, attribute.getName()), messageConsumer);diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.javaindex b881d8fb8..cfe8dda56 100644--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java@@ -132,7 +132,7 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulato* Call this to simulate a sensor update using the specified timestamp*/public void updateSensor(AttributeRef attributeRef, Object value, long timestamp) {- updateLinkedAttribute(new AttributeState(attributeRef, value), timestamp);+ updateLinkedAttribute(attributeRef, value, timestamp);}public Map<AttributeRef, ScheduledFuture<?>> getReplayMap() {@@ -163,7 +163,7 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoreturn executorService.schedule(() -> {LOG.fine("Updating asset " + attributeRef.getId() + " for attribute " + attributeRef.getName() + " with value " + nextDatapoint.value.toString());try {- updateLinkedAttribute(new AttributeState(attributeRef, nextDatapoint.value));+ updateLinkedAttribute(attributeRef, nextDatapoint.value);} catch (Exception e) {LOG.log(Level.SEVERE, "Exception thrown when updating value: %s", e);} finally {diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/storage/StorageSimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/storage/StorageSimulatorProtocol.javaindex 5b69fd50e..670596e90 100644--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/storage/StorageSimulatorProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/storage/StorageSimulatorProtocol.java@@ -26,7 +26,6 @@ import org.openremote.model.asset.impl.ElectricityStorageAsset;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.syslog.SyslogCategory;import java.time.Duration;@@ -91,7 +90,7 @@ public class StorageSimulatorProtocol extends AbstractProtocol<StorageSimulatorAreturn;}- updateLinkedAttribute(new AttributeState(event.getRef(), processedValue));+ updateLinkedAttribute(event.getRef(), processedValue);}protected void updateStorageAsset(ElectricityStorageAsset storageAsset) {@@ -152,9 +151,9 @@ public class StorageSimulatorProtocol extends AbstractProtocol<StorageSimulatorAlevel = newLevel;if (energyDelta > 0) {- updateLinkedAttribute(new AttributeState(storageAsset.getId(), ElectricityStorageAsset.ENERGY_IMPORT_TOTAL.getName(), storageAsset.getEnergyImportTotal().orElse(0d) + energyDelta));+ updateLinkedAttribute(new AttributeRef(storageAsset.getId(), ElectricityStorageAsset.ENERGY_IMPORT_TOTAL.getName()), storageAsset.getEnergyImportTotal().orElse(0d) + energyDelta);} else {- updateLinkedAttribute(new AttributeState(storageAsset.getId(), ElectricityStorageAsset.ENERGY_EXPORT_TOTAL.getName(), storageAsset.getEnergyExportTotal().orElse(0d) - energyDelta));+ updateLinkedAttribute(new AttributeRef(storageAsset.getId(), ElectricityStorageAsset.ENERGY_EXPORT_TOTAL.getName()), storageAsset.getEnergyExportTotal().orElse(0d) - energyDelta);}}}@@ -169,9 +168,9 @@ public class StorageSimulatorProtocol extends AbstractProtocol<StorageSimulatorApower = 0d;}- updateLinkedAttribute(new AttributeState(assetId, POWER.getName(), power));- updateLinkedAttribute(new AttributeState(assetId, ENERGY_LEVEL.getName(), level));- updateLinkedAttribute(new AttributeState(assetId, ENERGY_LEVEL_PERCENTAGE.getName(), capacity <= 0d ? 0 : (int) ((level / capacity) * 100)));+ updateLinkedAttribute(new AttributeRef(assetId, POWER.getName()), power);+ updateLinkedAttribute(new AttributeRef(assetId, ENERGY_LEVEL.getName()), level);+ updateLinkedAttribute(new AttributeRef(assetId, ENERGY_LEVEL_PERCENTAGE.getName()), capacity <= 0d ? 0 : (int) ((level / capacity) * 100));if (power != 0d) {lastUpdateMap.put(assetId, now);diff --git a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.javaindex 535f034b4..c56becf36 100644--- a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.java@@ -8,7 +8,6 @@ import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.syslog.SyslogCategory;import org.snmp4j.PDU;@@ -76,13 +75,13 @@ public class SNMPProtocol extends AbstractProtocol<SNMPAgent, SNMPAgentLink> {pdu.getVariableBindings().forEach(variableBinding -> {wildCardValue.put(variableBinding.getOid().format(), variableBinding.toValueString());});- updateLinkedAttribute(new AttributeState(wildCardAttributeRef, wildCardValue));+ updateLinkedAttribute(wildCardAttributeRef, wildCardValue);}pdu.getVariableBindings().forEach(variableBinding -> {AttributeRef attributeRef = oidMap.get(variableBinding.getOid().format());if (attributeRef != null) {- updateLinkedAttribute(new AttributeState(attributeRef, variableBinding.toValueString()));+ updateLinkedAttribute(attributeRef, variableBinding.toValueString());}});});diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.javaindex cda3dd63b..61ded7f38 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java@@ -111,7 +111,7 @@ public abstract class AbstractVelbusProtocol<S extends AbstractVelbusProtocol<S,LOG.fine("Linking attribute to device '" + deviceAddress + "' and property '" + property + "': " + attributeRef);Consumer<Object> propertyValueConsumer = propertyValue ->- updateLinkedAttribute(new AttributeState(attributeRef, propertyValue));+ updateLinkedAttribute(attributeRef, propertyValue);attributePropertyValueConsumers.put(attributeRef, propertyValueConsumer);network.addPropertyValueConsumer(deviceAddress, property, propertyValueConsumer);diff --git a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveProtocol.javaindex a326c4e6f..c52e3afbb 100644--- a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveProtocol.java@@ -26,7 +26,6 @@ import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.protocol.ProtocolAssetDiscovery;import org.openremote.model.syslog.SyslogCategory;import org.openremote.model.value.impl.ColourRGB;@@ -103,7 +102,7 @@ public class ZWaveProtocol extends AbstractProtocol<ZWaveAgent, ZWaveAgentLink>Class<?> clazz = attribute.getTypeClass();Consumer<Value> sensorValueConsumer = value ->- updateLinkedAttribute(new AttributeState(attributeRef, toAttributeValue(value, clazz)));+ updateLinkedAttribute(attributeRef, toAttributeValue(value, clazz));sensorValueConsumerMap.put(attributeRef, sensorValueConsumer);network.addSensorValueConsumer(nodeId, endpoint, linkName, sensorValueConsumer);diff --git a/gradle.properties b/gradle.propertiesindex 9b082a195..cb4aa2fcb 100644--- a/gradle.properties+++ b/gradle.properties@@ -24,7 +24,7 @@ junitVersion = 4.13.2spockVersion = 2.0-groovy-3.0byteBuddyVersion = 1.11.0objenesisVersion = 3.2-camelVersion = 4.0.1+camelVersion = 4.0.4sunriseSunsetCalculatorVersion = 1.2easyRulesVersion = 4.1.0quartzVersion= 2.3.2diff --git a/manager/src/main/java/org/openremote/manager/agent/AgentService.java b/manager/src/main/java/org/openremote/manager/agent/AgentService.javaindex 63e0b52cf..72b1aa2a7 100644--- a/manager/src/main/java/org/openremote/manager/agent/AgentService.java+++ b/manager/src/main/java/org/openremote/manager/agent/AgentService.java@@ -460,7 +460,7 @@ public class AgentService extends RouteBuilder implements ContainerService {}}protocolInstanceMap.remove(agent.getId());- LOG.log(Level.SEVERE, "Failed to start protocol: " + protocol, e);+ LOG.log(Level.SEVERE, "Failed to start protocol '" + protocol + "': " + agent, e);sendAttributeEvent(new AttributeEvent(agent.getId(), Agent.STATUS.getName(), ConnectionStatus.ERROR));}}@@ -622,8 +622,10 @@ public class AgentService extends RouteBuilder implements ContainerService {Protocol<?> protocolInstance = getProtocolInstance(agent.getId());if (protocolInstance == null) {- // Maybe agent was disabled and now isn't - use standard mechanism- deployAgent(agent);+ if (Agent.DISABLED.getName().equals(event.getName())) {+ // Maybe agent was disabled and now isn't - use standard mechanism+ deployAgent(agent);+ }return;}diff --git a/manager/src/main/java/org/openremote/manager/event/EventSubscriptions.java b/manager/src/main/java/org/openremote/manager/event/EventSubscriptions.javaindex 3239b6380..15da42795 100644--- a/manager/src/main/java/org/openremote/manager/event/EventSubscriptions.java+++ b/manager/src/main/java/org/openremote/manager/event/EventSubscriptions.java@@ -33,6 +33,7 @@ import org.openremote.model.util.TextUtil;import java.util.*;import java.util.concurrent.ConcurrentHashMap;import java.util.concurrent.ConcurrentMap;+import java.util.logging.Level;import java.util.logging.Logger;import static org.openremote.model.Constants.SESSION_KEY;@@ -156,8 +157,12 @@ public class EventSubscriptions {if (sessionSub.subscription.isInternal()) {if (triggeredEventSubscription.getEvents() != null) {- triggeredEventSubscription.getEvents().forEach(e ->- sessionSub.subscription.getInternalConsumer().accept(e));+ try {+ triggeredEventSubscription.getEvents().forEach(e ->+ sessionSub.subscription.getInternalConsumer().accept(e));+ } catch (Exception e) {+ LOG.log(Level.WARNING, "Internal subscription consumer has thrown an exception: id=" + triggeredEventSubscription.getSubscriptionId(), e);+ }}} else {Message msg = new DefaultMessage(exchange.getContext());diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationProcessingException.java b/manager/src/main/java/org/openremote/manager/notification/NotificationProcessingException.javaindex 6fe3e122b..692e3061f 100644--- a/manager/src/main/java/org/openremote/manager/notification/NotificationProcessingException.java+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationProcessingException.java@@ -81,15 +81,14 @@ public class NotificationProcessingException extends RuntimeException {}final protected Reason reason;- final protected String message;public NotificationProcessingException(Reason reason) {this(reason, null);}public NotificationProcessingException(Reason reason, String message) {+ super(message);this.reason = reason;- this.message = message;}public Reason getReason() {@@ -97,14 +96,14 @@ public class NotificationProcessingException extends RuntimeException {}public String getReasonPhrase() {- return getReason() + (message != null ? " (" + message + ")": "");+ return getReason() + (getMessage() != null ? " (" + getMessage() + ")": "");}@Overridepublic String toString() {return NotificationProcessingException.class.getSimpleName() + "{" +"reason=" + reason +- ", message='" + message + '\'' ++ ", message='" + getMessage() + '\'' +'}';}}diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java b/manager/src/main/java/org/openremote/manager/notification/NotificationService.javaindex 0a7ff24f8..7b71aab1f 100644--- a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationService.java@@ -197,11 +197,12 @@ public class NotificationService extends RouteBuilder implements ContainerServic}// Send message to each applicable target- AtomicBoolean success = new AtomicBoolean(true);+ AtomicReference<Exception> error = new AtomicReference<>();+ // As we can have multiple targets in a single exchange we'll track the first exception that occursmappedTargetsList.forEach(target -> {- boolean targetSuccess = persistenceService.doReturningTransaction(em -> {+ Exception notificationError = persistenceService.doReturningTransaction(em -> {// commit the notification first to get the IDSentNotification sentNotification = new SentNotification()@@ -240,19 +241,23 @@ public class NotificationService extends RouteBuilder implements ContainerServic}LOG.warning("Notification failed '" + id + "': " + target + ", reason=" + notificationProcessingException);sentNotification.setError(TextUtil.isNullOrEmpty(notificationProcessingException.getMessage()) ? "Unknown error" : notificationProcessingException.getMessage());- throw(notificationProcessingException);+ return notificationProcessingException;} finally {em.merge(sentNotification);}- return sentNotification.getError() == null;+ return null;});- if (!targetSuccess) {- success.set(false);++ if (notificationError != null && error.get() == null) {+ error.set(notificationError);}});- exchange.getMessage().setBody(success.get());+ exchange.getMessage().setBody(error.get() == null);+ if (error.get() != null) {+ throw error.get();+ }}).onException(Exception.class).logStackTrace(false)diff --git a/model-util/src/main/java/CustomExtension.java b/model-util/src/main/java/CustomExtension.javaindex 45fbde349..2c33aed9d 100644--- a/model-util/src/main/java/CustomExtension.java+++ b/model-util/src/main/java/CustomExtension.java@@ -21,11 +21,16 @@import cz.habarta.typescript.generator.Extension;import cz.habarta.typescript.generator.TsType;import cz.habarta.typescript.generator.compiler.ModelCompiler;+import cz.habarta.typescript.generator.compiler.ModelTransformer;+import cz.habarta.typescript.generator.compiler.SymbolTable;import cz.habarta.typescript.generator.compiler.TsModelTransformer;import cz.habarta.typescript.generator.emitter.EmitterExtensionFeatures;import cz.habarta.typescript.generator.emitter.TsBeanModel;import cz.habarta.typescript.generator.emitter.TsPropertyModel;+import cz.habarta.typescript.generator.parser.BeanModel;+import cz.habarta.typescript.generator.parser.Model;import org.openremote.model.asset.AssetTypeInfo;+import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.provisioning.X509ProvisioningConfig;import org.openremote.model.util.TsIgnoreTypeParams;@@ -88,6 +93,18 @@ public class CustomExtension extends Extension {});return model;+ }),+ new cz.habarta.typescript.generator.Extension.TransformerDefinition(ModelCompiler.TransformationPhase.BeforeTsModel, new ModelTransformer() {+ @Override+ public Model transformModel(SymbolTable symbolTable, Model model) {++ // Remove attribute state from attribute event (can't do this with annotations)+ BeanModel attrEventBean = model.getBean(AttributeEvent.class);+ if (attrEventBean != null) {+ attrEventBean.getProperties().removeIf(pm -> pm.getName().equals("attributeState"));+ }+ return model;+ }}));}diff --git a/model/src/main/java/org/openremote/model/asset/agent/Protocol.java b/model/src/main/java/org/openremote/model/asset/agent/Protocol.javaindex 5d4de71c8..1292c9525 100644--- a/model/src/main/java/org/openremote/model/asset/agent/Protocol.java+++ b/model/src/main/java/org/openremote/model/asset/agent/Protocol.java@@ -31,6 +31,7 @@ import org.openremote.model.value.MetaItemType;import org.openremote.model.value.ValueFilter;import java.util.Map;+import java.util.Optional;import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;@@ -214,17 +215,17 @@ public interface Protocol<T extends Agent<T, ?, ?>> {/*** Update the value of a linked {@link Attribute} linked to this {@link Protocol}; call this to publish new sensor- * values. Implementators are responsible for ensuring the requested {@link Attribute} is actually linked to this+ * values. Implementors are responsible for ensuring the requested {@link Attribute} is actually linked to this* {@link Protocol}.*/- void updateLinkedAttribute(final AttributeState state, long timestamp);+ void updateLinkedAttribute(final AttributeRef attributeRef, final Object value, long timestamp);/*** Update the value of a linked {@link Attribute} linked to this {@link Protocol}; call this to publish new sensor- * values. Implementators are responsible for ensuring the requested {@link Attribute} is actually linked to this+ * values. Implementors are responsible for ensuring the requested {@link Attribute} is actually linked to this* {@link Protocol}.*/- void updateLinkedAttribute(final AttributeState state);+ void updateLinkedAttribute(final AttributeRef attributeRef, final Object value);/**diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeEvent.java b/model/src/main/java/org/openremote/model/attribute/AttributeEvent.javaindex 47b4ef953..86b262d19 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeEvent.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeEvent.java@@ -19,9 +19,8 @@*/package org.openremote.model.attribute;-import com.fasterxml.jackson.annotation.JsonCreator;-import com.fasterxml.jackson.annotation.JsonIgnore;-import com.fasterxml.jackson.annotation.JsonView;+import com.fasterxml.jackson.annotation.*;+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;import com.fasterxml.jackson.databind.annotation.JsonSerialize;import jakarta.annotation.Nonnull;import org.openremote.model.asset.Asset;@@ -67,7 +66,7 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {@JsonView(Enhanced.class)protected Object oldValue;@JsonView(Enhanced.class)- protected long oldValueTimestamp;+ protected Long oldValueTimestamp;@JsonView(Enhanced.class)protected String[] path;@JsonView(Enhanced.class)@@ -89,7 +88,7 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {this(new AttributeRef(assetId, attributeName), value);}- public AttributeEvent(String assetId, String attributeName, Object value, long timestamp) {+ public AttributeEvent(String assetId, String attributeName, Object value, Long timestamp) {this(new AttributeRef(assetId, attributeName), value, timestamp);}@@ -97,7 +96,7 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {this(attributeState.getRef(), attributeState.getValue().orElse(null));}- public AttributeEvent(AttributeState attributeState, long timestamp) {+ public AttributeEvent(AttributeState attributeState, Long timestamp) {this(attributeState.getRef(), attributeState.getValue().orElse(null), timestamp);}@@ -105,7 +104,7 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {this(attributeRef, value, 0L);}- public AttributeEvent(AttributeRef ref, Object value, long timestamp) {+ public AttributeEvent(AttributeRef ref, Object value, Long timestamp) {super(timestamp);Objects.requireNonNull(ref);this.ref = ref;@@ -113,9 +112,8 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {}@JsonCreator- @Deprecated- // This allows backwards compatibility with old attribute event structure- protected AttributeEvent(AttributeState attributeState, AttributeRef ref, Object value, long timestamp) {+ // This allows backwards compatibility with old attribute event JSON that used attributeState+ protected AttributeEvent(AttributeState attributeState, AttributeRef ref, Object value, Long timestamp) {super(timestamp);if (attributeState != null) {this.ref = attributeState.getRef();@@ -126,7 +124,7 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {}}- public AttributeEvent(AssetInfo asset, Attribute<?> attribute, Object source, Object value, long valueTimestamp, Object oldValue, long oldValueTimestamp) {+ public AttributeEvent(AssetInfo asset, Attribute<?> attribute, Object source, Object value, Long valueTimestamp, Object oldValue, Long oldValueTimestamp) {this(new AttributeRef(asset.getId(), attribute.getName()),value, valueTimestamp);this.oldValue = oldValue;@@ -330,8 +328,9 @@ public class AttributeEvent extends SharedEvent implements AttributeInfo {public String toString() {String valueStr = Objects.toString(value);return getClass().getSimpleName() + "{" +- "timestamp=" + timestamp.toInstant() ++ "timestamp=" + (timestamp != null ? timestamp.toInstant() : "null") +", ref=" + ref ++ ", realm=" + realm +", value=" + (valueStr.length() > 100 ? valueStr.substring(0, 100) + "..." : valueStr) +"}";}diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeInfo.java b/model/src/main/java/org/openremote/model/attribute/AttributeInfo.javaindex f97bbbc1a..1b8222a8b 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeInfo.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeInfo.java@@ -1,5 +1,6 @@package org.openremote.model.attribute;+import com.fasterxml.jackson.annotation.JsonProperty;import org.openremote.model.asset.AssetInfo;import org.openremote.model.value.MetaHolder;import org.openremote.model.value.NameValueHolder;@@ -7,13 +8,24 @@ import org.openremote.model.value.NameValueHolder;import java.util.Optional;public interface AttributeInfo extends AssetInfo, NameValueHolder<Object>, MetaHolder, Comparable<AttributeInfo> {+ @JsonPropertylong getTimestamp();++ @JsonPropertyAttributeRef getRef();+String getId();+String getName();++ @JsonProperty+ Optional<Object> getValue();+AttributeState getState();+ @JsonPropertyOptional<Object> getOldValue();+ @JsonPropertylong getOldValueTimestamp();}diff --git a/model/src/main/java/org/openremote/model/datapoint/Datapoint.java b/model/src/main/java/org/openremote/model/datapoint/Datapoint.javaindex aeeddc110..3c11652c5 100644--- a/model/src/main/java/org/openremote/model/datapoint/Datapoint.java+++ b/model/src/main/java/org/openremote/model/datapoint/Datapoint.java@@ -63,7 +63,7 @@ public abstract class Datapoint implements Serializable {}public Datapoint(AttributeEvent stateEvent) {- this(stateEvent.getState(), stateEvent.getTimestamp());+ this(stateEvent.getRef(), stateEvent.getValue(), stateEvent.getTimestamp());}public Datapoint(AttributeRef attributeRef, Object value, long timestamp) {diff --git a/model/src/main/java/org/openremote/model/event/Event.java b/model/src/main/java/org/openremote/model/event/Event.javaindex edf7b01a3..1e2212bd4 100644--- a/model/src/main/java/org/openremote/model/event/Event.java+++ b/model/src/main/java/org/openremote/model/event/Event.java@@ -44,8 +44,10 @@ public abstract class Event {@JsonIgnoreprotected Date timestamp;- protected Event(long timestamp) {- this.timestamp = new Date(timestamp);+ protected Event(Long timestamp) {+ if (timestamp != null) {+ this.timestamp = new Date(timestamp);+ }}protected Event() {diff --git a/model/src/main/java/org/openremote/model/event/shared/SharedEvent.java b/model/src/main/java/org/openremote/model/event/shared/SharedEvent.javaindex e94b547cf..1bc3bd5cf 100644--- a/model/src/main/java/org/openremote/model/event/shared/SharedEvent.java+++ b/model/src/main/java/org/openremote/model/event/shared/SharedEvent.java@@ -61,7 +61,7 @@ public abstract class SharedEvent extends Event {public static final String MESSAGE_PREFIX = "EVENT:";- public SharedEvent(long timestamp) {+ public SharedEvent(Long timestamp) {super(timestamp);}diff --git a/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.java b/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.javaindex 0b73b4e73..887441829 100644--- a/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.java+++ b/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.java@@ -22,9 +22,9 @@ package org.openremote.model.protocol;import org.openremote.model.Constants;import org.openremote.model.asset.agent.AgentLink;import org.openremote.model.attribute.Attribute;-import org.openremote.model.attribute.AttributeLink;-import org.openremote.model.attribute.AttributeState;import org.openremote.model.attribute.AttributeInfo;+import org.openremote.model.attribute.AttributeLink;+import org.openremote.model.attribute.AttributeRef;import org.openremote.model.query.filter.ValuePredicate;import org.openremote.model.syslog.SyslogCategory;import org.openremote.model.util.Pair;@@ -37,6 +37,7 @@ import java.util.Locale;import java.util.Map;import java.util.Optional;import java.util.concurrent.atomic.AtomicReference;+import java.util.function.BiConsumer;import java.util.function.Consumer;import java.util.function.Supplier;import java.util.logging.Logger;@@ -192,7 +193,7 @@ public final class ProtocolUtil {.orElse(new Pair<>(true, value)));}- public static Consumer<String> createGenericAttributeMessageConsumer(String assetId, Attribute<?> attribute, AgentLink<?> agentLink, Supplier<Long> currentMillisSupplier, Consumer<AttributeState> stateConsumer) {+ public static Consumer<String> createGenericAttributeMessageConsumer(String assetId, Attribute<?> attribute, AgentLink<?> agentLink, Supplier<Long> currentMillisSupplier, BiConsumer<AttributeRef, Object> stateConsumer) {ValueFilter[] matchFilters = agentLink.getMessageMatchFilters().orElse(null);ValuePredicate matchPredicate = agentLink.getMessageMatchPredicate().orElse(null);@@ -207,7 +208,7 @@ public final class ProtocolUtil {if (messageFiltered != null) {if (matchPredicate.asPredicate(currentMillisSupplier).test(messageFiltered)) {LOG.finest("Inbound message meets attribute matching meta so writing state to state consumer for attribute: asssetId=" + assetId + ", attribute=" + attribute.getName());- stateConsumer.accept(new AttributeState(assetId, attribute.getName(), message));+ stateConsumer.accept(new AttributeRef(assetId, attribute.getName()), message);}}}diff --git a/project.gradle b/project.gradleindex feca9d698..bd72d5680 100644--- a/project.gradle+++ b/project.gradle@@ -189,6 +189,9 @@ repositories {maven {url "https://pkgs.dev.azure.com/OpenRemote/OpenRemote/_packaging/OpenRemote/maven/v1"}+ maven {+ url "https://s01.oss.sonatype.org/content/repositories/snapshots"+ }}// Eclipse needs help@@ -374,7 +377,7 @@ def createTSGeneratorConfig(boolean outputAPIClient, String outputFileName, Proj}def resolveDependency(String path) {- "io.openremote:openremote-" + path.substring(1) + ":" + version+ isCustomProject() ? resolveProject(path) : "io.openremote:openremote-" + path.substring(1) + ":" + version}ext {diff --git a/setup/src/integration/java/org/openremote/setup/integration/protocol/MockProtocol.java b/setup/src/integration/java/org/openremote/setup/integration/protocol/MockProtocol.javaindex 3c052caaa..06dd7b652 100644--- a/setup/src/integration/java/org/openremote/setup/integration/protocol/MockProtocol.java+++ b/setup/src/integration/java/org/openremote/setup/integration/protocol/MockProtocol.java@@ -26,6 +26,7 @@ import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.asset.impl.ThingAsset;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;+import org.openremote.model.attribute.AttributeRef;import org.openremote.model.attribute.AttributeState;import org.openremote.model.protocol.ProtocolAssetDiscovery;import org.openremote.model.value.ValueType;@@ -87,7 +88,7 @@ public class MockProtocol extends AbstractProtocol<MockAgent, MockAgentLink> impprotocolMethodCalls.add("WRITE_ATTRIBUTE:" + event.getId() + ":" + event.getName());protocolWriteAttributeEvents.add(event);if (updateSensor) {- updateReceived(event.getState());+ updateReceived(event.getRef(), event.getValue(), event.getTimestamp());}}@@ -101,11 +102,15 @@ public class MockProtocol extends AbstractProtocol<MockAgent, MockAgentLink> impreturn "mock://" + getAgent().getId();}- public void updateReceived(AttributeState state) {+ public void updateReceived(final AttributeRef attributeRef, final Object value, Long timestamp) {// Assume we've pushed the update to the actual device and it responded with OK// so now we want to cause a sensor update that will go through the processing// chain.- updateLinkedAttribute(state);+ if (timestamp != null) {+ updateLinkedAttribute(attributeRef, value, timestamp);+ } else {+ updateLinkedAttribute(attributeRef, value);+ }}protected void updateAttribute(AttributeState state) {diff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovyindex 151dde221..32cb7eea5 100644--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy@@ -61,10 +61,14 @@ class NotificationTest extends Specification implements ManagerContainerTrait {def consoleResource = (ConsoleResourceImpl)container.getService(ManagerWebService.class).apiSingletons.find {it instanceof ConsoleResourceImpl}and: "a mock push notification handler"+ def throwPushHandlerException = falsePushNotificationHandler mockPushNotificationHandler = Spy(pushNotificationHandler)mockPushNotificationHandler.isValid() >> truemockPushNotificationHandler.sendMessage(_ as Long, _ as Notification.Source, _ as String, _ as Notification.Target, _ as AbstractNotificationMessage) >> {id, source, sourceId, target, message ->+ if (throwPushHandlerException) {+ throw new Exception("Failed to send notification")+ }notificationIds << idnotificationTargetTypes << target.typenotificationTargetIds << target.id@@ -352,6 +356,22 @@ class NotificationTest extends Specification implements ManagerContainerTrait {assert !notificationTargetIds.contains(testuser3Console1.id)}+ when: "a notification handler throws an exception"+ throwPushHandlerException = true+ advancePseudoClock(1, TimeUnit.HOURS, container)+ adminNotificationResource.sendNotification(null, notification)++ then: "a bad request exception should be thrown"+ ex = thrown()+ ex.response.status == 400++ and: "the notification should be recorded in the DB with the exception set as the error"+ conditions.eventually {+ notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id)+ notifications.last().error == "Failed to send notification"+ }++// -----------------------------------------------// Check notification resource// -----------------------------------------------@@ -369,7 +389,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {n.deliveredOn == null &&n.acknowledgedOn == null}- assert adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id).length == 7+ assert adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id).length == 8assert adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id).length == 4}@@ -481,6 +501,8 @@ class NotificationTest extends Specification implements ManagerContainerTrait {// -----------------------------------------------when: "a repeat frequency is set and a notification is sent"+ // Clear exception flag+ throwPushHandlerException = false// Move clock to beginning of next hourdef advancement = Instant.ofEpochMilli(getClockTimeOf(container)).truncatedTo(ChronoUnit.HOURS)diff --git a/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovyindex 44af91d75..7abedaf80 100644--- a/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy@@ -228,8 +228,8 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {assert !((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).linkedAttributes.any {it.value.name == "invalidToggle1"}when: "values are sent to the linked attributes by the protocol"- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeState(mockThing.id, "lightToggle1", true))- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeState(mockThing.id, "tempTarget1", 25.5d))+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "lightToggle1"), true, null)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "tempTarget1"), 25.5d, null)then: "the linked attributes values should have been updated by the protocol"conditions.eventually {@@ -318,8 +318,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "a sensor value is received that links to an attribute using a regex filter"- def state = new AttributeState(mockThing.id, "filterRegex", "s100 d56 g1212")- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterRegex"), "s100 d56 g1212", null)then: "the linked attributes value should be updated with the filtered result"conditions.eventually {@@ -328,8 +327,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "the same attribute receives a sensor value that doesn't match the regex filter (match index invalid)"- state = new AttributeState(mockThing.id, "filterRegex", "s100")- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterRegex"), "s100", null)then: "the linked attributes value should be updated to null"conditions.eventually {@@ -338,8 +336,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "the same attribute receives a sensor value that doesn't match the regex filter (no match)"- state = new AttributeState(mockThing.id, "filterRegex", "no match to be found!")- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterRegex"), "no match to be found!", null)then: "the linked attributes value should be updated to null"conditions.eventually {@@ -348,8 +345,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "a sensor value is received that links to an attribute using a substring filter"- state = new AttributeState(mockThing.id, "filterSubstring", "Substring test value")- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterSubstring"), "Substring test value", null)then: "the linked attributes value should be updated with the filtered result"conditions.eventually {@@ -358,8 +354,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "the same attribute receives a sensor value that doesn't match the substring filter"- state = new AttributeState(mockThing.id, "filterSubstring", "Substring")- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterSubstring"), "Substring", null)then: "the linked attributes value should be updated to null"conditions.eventually {@@ -368,8 +363,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "a sensor value is received that links to an attribute using a regex and substring filter"- state = new AttributeState(mockThing.id, "filterRegexSubstring", '{"prop1":true,"prop2":"volume is at 90%"}')- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterRegexSubstring"), '{"prop1":true,"prop2":"volume is at 90%"}', null)then: "the linked attributes value should be updated with the filtered result"conditions.eventually {@@ -378,8 +372,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {}when: "the same attribute receives a sensor value that doesn't match the substring filter"- state = new AttributeState(mockThing.id, "filterRegexSubstring", '"volume is at 90%"}')- ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(state)+ ((MockProtocol)agentService.getProtocolInstance(mockAgent1.id)).updateReceived(new AttributeRef(mockThing.id, "filterRegexSubstring"), '"volume is at 90%"}', null)then: "the linked attributes value should be updated to null"conditions.eventually {