Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Protocol message filters renamed value filters

Rich Turneraa76a292695d
diff --git a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
index 3cb2b622c..612e17189 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
@@ -21,7 +21,7 @@ package org.openremote.agent.protocol;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
-import org.openremote.agent.protocol.filter.MessageFilter;
+import org.openremote.model.value.ValueFilter;
import org.openremote.container.Container;
import org.openremote.container.ContainerService;
import org.openremote.container.concurrent.GlobalLock;
@@ -111,7 +111,7 @@ public abstract class AbstractProtocol implements Protocol {
public static final int PRIORITY = ContainerService.DEFAULT_PRIORITY - 100;
protected final Map<AttributeRef, AssetAttribute> linkedAttributes = new HashMap<>();
protected final Map<AttributeRef, LinkedProtocolInfo> linkedProtocolConfigurations = new HashMap<>();
- protected final Map<AttributeRef, List<MessageFilter>> linkedAttributeFilters = new HashMap<>();
+ protected final Map<AttributeRef, List<ValueFilter>> linkedAttributeFilters = new HashMap<>();
protected static final List<MetaItemDescriptor> attributeMetaItemDescriptors;
protected MessageBrokerContext messageBrokerContext;
protected ProducerTemplate producerTemplate;
@@ -217,7 +217,7 @@ public abstract class AbstractProtocol implements Protocol {
// linking process and without entry in the map any update would be blocked
linkedAttributes.put(attributeRef, attribute);
- Optional<List<MessageFilter>> messageFilters = Protocol.getLinkedAttributeMessageFilters(attribute);
+ Optional<List<ValueFilter>> messageFilters = Protocol.getLinkedAttributeMessageFilters(attribute);
messageFilters.ifPresent(mFilters -> {
linkedAttributeFilters.put(attributeRef, mFilters);
});
@@ -309,7 +309,7 @@ public abstract class AbstractProtocol implements Protocol {
/**
* Update the value of a linked attribute. Call this to publish new sensor values. This will apply any
- * {@link MessageFilter}s that have been set for the {@link Attribute} against the {@link AttributeState#getValue}
+ * {@link ValueFilter}s that have been set for the {@link Attribute} against the {@link AttributeState#getValue}
* before sending on the sensor queue.
*/
@SuppressWarnings("unchecked")
@@ -324,7 +324,7 @@ public abstract class AbstractProtocol implements Protocol {
}
if (state.getValue().isPresent()) {
- List<MessageFilter> filters;
+ List<ValueFilter> filters;
Value value = state.getValue().get();
filters = linkedAttributeFilters.get(state.getAttributeRef());
@@ -332,7 +332,7 @@ public abstract class AbstractProtocol implements Protocol {
if (filters != null) {
LOG.fine("Applying message filters to sensor value...");
- for (MessageFilter filter : filters) {
+ for (ValueFilter filter : filters) {
boolean filterOk = filter.getMessageType() == value.getType().getModelType();
if (!filterOk) {
diff --git a/agent/src/main/java/org/openremote/agent/protocol/Protocol.java b/agent/src/main/java/org/openremote/agent/protocol/Protocol.java
index 184e00ede..60632c485 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/Protocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/Protocol.java
@@ -21,7 +21,7 @@ package org.openremote.agent.protocol;
import org.apache.commons.codec.binary.BinaryCodec;
import org.apache.commons.codec.binary.Hex;
-import org.openremote.agent.protocol.filter.MessageFilter;
+import org.openremote.model.value.ValueFilter;
import org.openremote.container.Container;
import org.openremote.container.ContainerService;
import org.openremote.model.AbstractValueHolder;
@@ -199,10 +199,10 @@ public interface Protocol extends ContainerService {
null);
/**
- * {@link MetaItem} for defining {@link MessageFilter}s to apply to values before they are sent on the
+ * {@link MetaItem} for defining {@link ValueFilter}s to apply to values before they are sent on the
* {@link #SENSOR_QUEUE} (i.e. before it is used to update a protocol linked attribute); this is particularly
* useful for generic protocols. The {@link MetaItem} value should be an {@link ArrayValue} of {@link ObjectValue}s
- * where each {@link ObjectValue} represents a serialised {@link MessageFilter}. The message should pass through the
+ * where each {@link ObjectValue} represents a serialised {@link ValueFilter}. The message should pass through the
* filters in array order.
*/
MetaItemDescriptor META_VALUE_FILTERS = metaItemArray(
@@ -289,9 +289,9 @@ public interface Protocol extends ContainerService {
AttributeValidationResult validateProtocolConfiguration(AssetAttribute protocolConfiguration);
/**
- * Extract the {@link MessageFilter}s from the specified {@link Attribute}
+ * Extract the {@link ValueFilter}s from the specified {@link Attribute}
*/
- static Optional<List<MessageFilter>> getLinkedAttributeMessageFilters(Attribute attribute) {
+ static Optional<List<ValueFilter>> getLinkedAttributeMessageFilters(Attribute attribute) {
if (attribute == null) {
return Optional.empty();
}
@@ -305,11 +305,11 @@ public interface Protocol extends ContainerService {
try {
ArrayValue arrayValue = arrayValueOptional.get();
- List<MessageFilter> messageFilters = new ArrayList<>(arrayValue.length());
+ List<ValueFilter> messageFilters = new ArrayList<>(arrayValue.length());
for (int i = 0; i < arrayValue.length(); i++) {
ObjectValue objValue = arrayValue.getObject(i).orElseThrow(() ->
new IllegalArgumentException("Attribute protocol filters meta item is invalid"));
- MessageFilter filter = deserialiseMessageFilter(objValue);
+ ValueFilter filter = deserialiseMessageFilter(objValue);
messageFilters.add(filter);
}
return messageFilters.isEmpty() ? Optional.empty() : Optional.of(messageFilters);
@@ -321,12 +321,12 @@ public interface Protocol extends ContainerService {
}
/**
- * Deserialise a {@link MessageFilter} from an {@link ObjectValue}
+ * Deserialise a {@link ValueFilter} from an {@link ObjectValue}
*/
- static MessageFilter deserialiseMessageFilter(ObjectValue objectValue) throws IllegalArgumentException {
+ static ValueFilter deserialiseMessageFilter(ObjectValue objectValue) throws IllegalArgumentException {
String json = objectValue.toJson();
try {
- return Container.JSON.readValue(json, MessageFilter.class);
+ return Container.JSON.readValue(json, ValueFilter.class);
} catch (IOException ioException) {
LOG.log(Level.WARNING, "Failed to deserialise message filter", ioException);
throw new IllegalArgumentException(ioException);
diff --git a/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties b/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties
index ed0607a07..860c83b54 100644
--- a/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties
+++ b/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties
@@ -407,9 +407,9 @@ metaItemDisplayName[urnopenremoteprotocolcontrollerClientcommandsMap]=Controller
metaItemDisplayName[urnopenremoteprotocolcontrollerClientbaseUri]=Controller base URI
metaItemDisplayName[urnopenremoteprotocoludpClienthost]=UDP server hostname/IP
metaItemDisplayName[urnopenremoteprotocoludpClientport]=UDP server port
-metaItemDisplayName[urnopenremoteprotocoludpClientbindPort]=UDP Client bind port
+metaItemDisplayName[urnopenremoteprotocoludpClientbindPort]=UDP client bind port
metaItemDisplayName[urnopenremoteprotocoludpClientresponseTimeoutMillis]=Response timeout (ms)
-metaItemDisplayName[urnopenremoteprotocoludpClientsendRetries]=No. of Retries
+metaItemDisplayName[urnopenremoteprotocoludpClientsendRetries]=Send retries
metaItemDisplayName[urnopenremoteprotocoludpClientserverAlwaysResponds]=UDP server always responds
diff --git a/container/src/main/java/org/openremote/container/util/Util.java b/container/src/main/java/org/openremote/container/util/Util.java
index c4c0eaa9a..1384fdfac 100644
--- a/container/src/main/java/org/openremote/container/util/Util.java
+++ b/container/src/main/java/org/openremote/container/util/Util.java
@@ -1,9 +1,16 @@
package org.openremote.container.util;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.openremote.container.Container;
+import org.openremote.model.value.ObjectValue;
+import org.openremote.model.value.Values;
+
+import javax.validation.constraints.NotNull;
import java.lang.reflect.Array;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
@@ -13,6 +20,18 @@ import java.util.function.Predicate;
* TODO Old functions for old rules, can be deleted?
*/
public class Util {
+
+ /**
+ * Convert a JSON serialisable object to an {@link ObjectValue}
+ */
+ public static Optional<ObjectValue> objectToValue(@NotNull Object obj) {
+ try {
+ String json = Container.JSON.writeValueAsString(obj);
+ return Values.parse(json);
+ } catch (JsonProcessingException ignore) {}
+ return Optional.empty();
+ }
+
public static <T> T[] reverseArray(T[] array, Class<T> clazz) {
if (array == null) {
return null;
diff --git a/agent/src/main/java/org/openremote/agent/protocol/filter/JsonFilter.java b/model/src/main/java/org/openremote/model/value/JsonValueFilter.java
similarity index 85%
rename from agent/src/main/java/org/openremote/agent/protocol/filter/JsonFilter.java
rename to model/src/main/java/org/openremote/model/value/JsonValueFilter.java
index 1bb793474..3478c3600 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/filter/JsonFilter.java
+++ b/model/src/main/java/org/openremote/model/value/JsonValueFilter.java
@@ -17,24 +17,20 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package org.openremote.agent.protocol.filter;
+package org.openremote.model.value;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import org.openremote.model.util.TextUtil;
-import org.openremote.model.value.*;
import java.util.Arrays;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import static org.openremote.agent.protocol.filter.RegexFilter.NAME;
+import static org.openremote.model.value.RegexValueFilter.NAME;
@JsonTypeName(NAME)
-public class JsonFilter extends MessageFilter<ObjectValue> {
+public class JsonValueFilter extends ValueFilter<ObjectValue> {
public static final String NAME = "json";
@@ -42,11 +38,11 @@ public class JsonFilter extends MessageFilter<ObjectValue> {
protected List<String> path;
@JsonCreator
- public JsonFilter(@JsonProperty("path") List<String> path) {
+ public JsonValueFilter(@JsonProperty("path") List<String> path) {
this.path = path;
}
- public JsonFilter(String... path) {
+ public JsonValueFilter(String... path) {
this(Arrays.asList(path));
}
diff --git a/agent/src/main/java/org/openremote/agent/protocol/filter/RegexFilter.java b/model/src/main/java/org/openremote/model/value/RegexValueFilter.java
similarity index 81%
rename from agent/src/main/java/org/openremote/agent/protocol/filter/RegexFilter.java
rename to model/src/main/java/org/openremote/model/value/RegexValueFilter.java
index eff813d7d..12d566ed6 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/filter/RegexFilter.java
+++ b/model/src/main/java/org/openremote/model/value/RegexValueFilter.java
@@ -17,23 +17,20 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package org.openremote.agent.protocol.filter;
+package org.openremote.model.value;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
-import org.openremote.model.value.StringValue;
-import org.openremote.model.value.Value;
-import org.openremote.model.value.Values;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import static org.openremote.agent.protocol.filter.RegexFilter.NAME;
+import static org.openremote.model.value.RegexValueFilter.NAME;
@JsonTypeName(NAME)
-public class RegexFilter extends MessageFilter<StringValue> {
+public class RegexValueFilter extends ValueFilter<StringValue> {
public static final String NAME = "regex";
@@ -45,9 +42,9 @@ public class RegexFilter extends MessageFilter<StringValue> {
protected int matchIndex;
@JsonCreator
- public RegexFilter(@JsonProperty("pattern") String regex,
- @JsonProperty("matchGroup") int matchGroup,
- @JsonProperty("matchIndex") int matchIndex) {
+ public RegexValueFilter(@JsonProperty("pattern") String regex,
+ @JsonProperty("matchGroup") int matchGroup,
+ @JsonProperty("matchIndex") int matchIndex) {
try {
pattern = Pattern.compile(regex);
this.matchGroup = matchGroup;
@@ -55,7 +52,7 @@ public class RegexFilter extends MessageFilter<StringValue> {
} catch (PatternSyntaxException ignore) {}
}
- public RegexFilter(Pattern pattern, int matchGroup, int matchIndex) {
+ public RegexValueFilter(Pattern pattern, int matchGroup, int matchIndex) {
this.pattern = pattern;
this.matchGroup = matchGroup;
this.matchIndex = matchIndex;
diff --git a/agent/src/main/java/org/openremote/agent/protocol/filter/SubStringFilter.java b/model/src/main/java/org/openremote/model/value/SubStringValueFilter.java
similarity index 79%
rename from agent/src/main/java/org/openremote/agent/protocol/filter/SubStringFilter.java
rename to model/src/main/java/org/openremote/model/value/SubStringValueFilter.java
index e599c30a0..5f84cd57f 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/filter/SubStringFilter.java
+++ b/model/src/main/java/org/openremote/model/value/SubStringValueFilter.java
@@ -17,19 +17,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package org.openremote.agent.protocol.filter;
+package org.openremote.model.value;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
-import org.openremote.model.value.StringValue;
-import org.openremote.model.value.Value;
-import org.openremote.model.value.Values;
-import static org.openremote.agent.protocol.filter.SubStringFilter.NAME;
+import static org.openremote.model.value.SubStringValueFilter.NAME;
@JsonTypeName(NAME)
-public class SubStringFilter extends MessageFilter<StringValue> {
+public class SubStringValueFilter extends ValueFilter<StringValue> {
public static final String NAME = "substring";
@@ -39,12 +36,12 @@ public class SubStringFilter extends MessageFilter<StringValue> {
protected Integer endIndex;
@JsonCreator
- public SubStringFilter(@JsonProperty("beginIndex") int beginIndex, @JsonProperty("endIndex") Integer endIndex) {
+ public SubStringValueFilter(@JsonProperty("beginIndex") int beginIndex, @JsonProperty("endIndex") Integer endIndex) {
this.beginIndex = beginIndex;
this.endIndex = endIndex;
}
- public SubStringFilter(int beginIndex) {
+ public SubStringValueFilter(int beginIndex) {
this.beginIndex = beginIndex;
}
diff --git a/agent/src/main/java/org/openremote/agent/protocol/filter/MessageFilter.java b/model/src/main/java/org/openremote/model/value/ValueFilter.java
similarity index 65%
rename from agent/src/main/java/org/openremote/agent/protocol/filter/MessageFilter.java
rename to model/src/main/java/org/openremote/model/value/ValueFilter.java
index fdeed0960..c4b7775c7 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/filter/MessageFilter.java
+++ b/model/src/main/java/org/openremote/model/value/ValueFilter.java
@@ -17,18 +17,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-package org.openremote.agent.protocol.filter;
+package org.openremote.model.value;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import org.openremote.container.Container;
-import org.openremote.model.value.ObjectValue;
-import org.openremote.model.value.Value;
-import org.openremote.model.value.ValueType;
-import org.openremote.model.value.Values;
-
-import java.util.Optional;
/**
* Interface for a filter that can be applied to messages of type &lt;T&gt; the filter can return a different
@@ -42,11 +34,11 @@ import java.util.Optional;
*/
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
- @JsonSubTypes.Type(name = RegexFilter.NAME, value = RegexFilter.class),
- @JsonSubTypes.Type(name = SubStringFilter.NAME, value = SubStringFilter.class),
- @JsonSubTypes.Type(name = JsonFilter.NAME, value = JsonFilter.class)
+ @JsonSubTypes.Type(name = RegexValueFilter.NAME, value = RegexValueFilter.class),
+ @JsonSubTypes.Type(name = SubStringValueFilter.NAME, value = SubStringValueFilter.class),
+ @JsonSubTypes.Type(name = JsonValueFilter.NAME, value = JsonValueFilter.class)
})
-public abstract class MessageFilter<T extends Value> {
+public abstract class ValueFilter<T extends Value> {
/**
* Get the message type
@@ -58,14 +50,4 @@ public abstract class MessageFilter<T extends Value> {
*/
public abstract Value process(T message);
- /**
- * Convert this filter to an {@link ObjectValue}
- */
- public Optional<ObjectValue> toValue() {
- try {
- String json = Container.JSON.writeValueAsString(this);
- return Values.parse(json);
- } catch (JsonProcessingException ignore) {}
- return Optional.empty();
- }
}
diff --git a/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy b/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy
index 23a45cf89..6a6637812 100644
--- a/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy
@@ -372,7 +372,7 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
}
// TODO: Update once console permissions model finalised
// when: "an anonymous user updates the location of a console linked to users"
-// anonymousAssetResource.writeAttributeValue(null, testUser3Console1.id, LOCATION.name, new GeoJSONPoint(0d, 0d, 0d).toValue().toJson())
+// anonymousAssetResource.writeAttributeValue(null, testUser3Console1.id, LOCATION.name, new GeoJSONPoint(0d, 0d, 0d).objectToValue().toJson())
//
// then: "the result should be forbidden"
// ex = thrown()
diff --git a/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy
index 3e56b6767..50bace3e3 100644
--- a/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy
@@ -21,8 +21,7 @@ package org.openremote.test.protocol
import org.openremote.agent.protocol.AbstractProtocol
import org.openremote.agent.protocol.Protocol
-import org.openremote.agent.protocol.filter.RegexFilter
-import org.openremote.agent.protocol.filter.SubStringFilter
+import org.openremote.container.util.Util
import org.openremote.manager.agent.AgentService
import org.openremote.manager.asset.AssetProcessingService
import org.openremote.manager.asset.AssetStorageService
@@ -32,6 +31,8 @@ import org.openremote.model.asset.AssetType
import org.openremote.model.asset.agent.ConnectionStatus
import org.openremote.model.asset.agent.ProtocolConfiguration
import org.openremote.model.attribute.*
+import org.openremote.model.value.RegexValueFilter
+import org.openremote.model.value.SubStringValueFilter
import org.openremote.model.value.Values
import org.openremote.test.GwtClientTrait
import org.openremote.test.ManagerContainerTrait
@@ -311,7 +312,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,
),
new MetaItem(
Protocol.META_VALUE_FILTERS,
- Values.createArray().add(new RegexFilter("\\w(\\d+)", 1, 2).toValue().get())
+ Values.createArray().add(Util.objectToValue(new RegexValueFilter("\\w(\\d+)", 1, 2)).get())
)
),
new AssetAttribute("filterSubstring", AttributeValueType.STRING)
@@ -323,7 +324,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,
),
new MetaItem(
Protocol.META_VALUE_FILTERS,
- Values.createArray().add(new SubStringFilter(10, 12).toValue().get())
+ Values.createArray().add(Util.objectToValue(new SubStringValueFilter(10, 12)).get())
)
),
new AssetAttribute("filterRegexSubstring", AttributeValueType.NUMBER)
@@ -336,8 +337,8 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,
new MetaItem(
Protocol.META_VALUE_FILTERS,
Values.createArray()
- .add(new SubStringFilter(23).toValue().get())
- .add(new RegexFilter("[a-z|\\s]+(\\d+)%\"}", 1, 0).toValue().get())
+ .add(Util.objectToValue(new SubStringValueFilter(23)).get())
+ .add(Util.objectToValue(new RegexValueFilter("[a-z|\\s]+(\\d+)%\"}", 1, 0)).get())
)
)
)
diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy
index 8a99d52f4..e2d587d77 100644
--- a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy
@@ -22,7 +22,7 @@ package org.openremote.test.protocol.http
import org.jboss.resteasy.spi.ResteasyUriInfo
import org.jboss.resteasy.util.BasicAuthHelper
import org.openremote.agent.protocol.Protocol
-import org.openremote.agent.protocol.filter.RegexFilter
+import org.openremote.container.util.Util
import org.openremote.agent.protocol.http.*
import org.openremote.manager.agent.AgentService
import org.openremote.manager.asset.AssetProcessingService
@@ -39,6 +39,7 @@ import org.openremote.model.attribute.AttributeRef
import org.openremote.model.attribute.AttributeValueType
import org.openremote.model.attribute.MetaItem
import org.openremote.model.value.ObjectValue
+import org.openremote.model.value.RegexValueFilter
import org.openremote.model.value.Value
import org.openremote.model.value.Values
import org.openremote.test.ManagerContainerTrait
@@ -494,7 +495,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
new MetaItem(HttpClientProtocol.META_POLLING_MILLIS, Values.create(50)), // This is ms in testing
new MetaItem(
Protocol.META_VALUE_FILTERS,
- Values.createArray().add(new RegexFilter("\\d+", 0, 0).toValue().get())
+ Values.createArray().add(Util.objectToValue(new RegexValueFilter("\\d+", 0, 0)).get())
)
),
// attribute that polls the server using GET and uses regex filter on response
@@ -505,7 +506,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
new MetaItem(HttpClientProtocol.META_POLLING_MILLIS, Values.create(40)), // This is ms in testing
new MetaItem(
Protocol.META_VALUE_FILTERS,
- Values.createArray().add(new RegexFilter("\\d+", 0, 1).toValue().get())
+ Values.createArray().add(Util.objectToValue(new RegexValueFilter("\\d+", 0, 1)).get())
)
)
)
diff --git a/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusBasicTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusBasicTest.groovy
index d2b13ed00..061a67baf 100644
--- a/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusBasicTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusBasicTest.groovy
@@ -2143,7 +2143,7 @@ class VelbusBasicTest extends Specification implements ManagerContainerTrait {
// }
//
// when: "a output channel is set to last"
-// device.writeProperty("OUTPUT4", AnalogOutputProcessor.ChannelState.LAST.toValue(ValueType.STRING))
+// device.writeProperty("OUTPUT4", AnalogOutputProcessor.ChannelState.LAST.objectToValue(ValueType.STRING))
//
// then: "the output should go to 5V"
// conditions.eventually {