Skip to content

armgit / core

Public Imported from GitHub
0

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

Class name cleanup

Rich Turner01c837ea1b7d
diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.java b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.java
index d5ecca7c7..cf80e87f7 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.java
@@ -32,9 +32,9 @@ import java.util.Map;
import java.util.Optional;
@Entity
-public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClientAgentLink> {
+public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpAgentLink> {
- public static class HttpClientAgentLink extends AgentLink<HttpClientAgentLink> {
+ public static class HttpAgentLink extends AgentLink<HttpAgentLink> {
protected Map<String, List<String>> headers;
protected Map<String, List<String>> queryParameters;
@@ -46,9 +46,9 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
protected String pollingAttribute;
// For Hydrators
- protected HttpClientAgentLink() {}
+ protected HttpAgentLink() {}
- public HttpClientAgentLink(String id) {
+ public HttpAgentLink(String id) {
super(id);
}
@@ -56,7 +56,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(headers);
}
- public HttpClientAgentLink setHeaders(ValueType.MultivaluedStringMap headers) {
+ public HttpAgentLink setHeaders(ValueType.MultivaluedStringMap headers) {
this.headers = headers;
return this;
}
@@ -65,7 +65,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(queryParameters);
}
- public HttpClientAgentLink setQueryParameters(ValueType.MultivaluedStringMap queryParameters) {
+ public HttpAgentLink setQueryParameters(ValueType.MultivaluedStringMap queryParameters) {
this.queryParameters = queryParameters;
return this;
}
@@ -74,7 +74,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(pollingMillis);
}
- public HttpClientAgentLink setPollingMillis(Integer pollingMillis) {
+ public HttpAgentLink setPollingMillis(Integer pollingMillis) {
this.pollingMillis = pollingMillis;
return this;
}
@@ -83,7 +83,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(pagingMode);
}
- public HttpClientAgentLink setPagingMode(Boolean pagingMode) {
+ public HttpAgentLink setPagingMode(Boolean pagingMode) {
this.pagingMode = pagingMode;
return this;
}
@@ -92,7 +92,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(path);
}
- public HttpClientAgentLink setPath(String path) {
+ public HttpAgentLink setPath(String path) {
this.path = path;
return this;
}
@@ -101,7 +101,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(method);
}
- public HttpClientAgentLink setMethod(HTTPMethod method) {
+ public HttpAgentLink setMethod(HTTPMethod method) {
this.method = method;
return this;
}
@@ -110,7 +110,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(contentType);
}
- public HttpClientAgentLink setContentType(String contentType) {
+ public HttpAgentLink setContentType(String contentType) {
this.contentType = contentType;
return this;
}
@@ -119,7 +119,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
return Optional.ofNullable(pollingAttribute);
}
- public HttpClientAgentLink setPollingAttribute(String pollingAttribute) {
+ public HttpAgentLink setPollingAttribute(String pollingAttribute) {
this.pollingAttribute = pollingAttribute;
return this;
}
@@ -133,8 +133,8 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClie
public static final AttributeDescriptor<ValueType.MultivaluedStringMap> REQUEST_QUERY_PARAMETERS = new AttributeDescriptor<>("requestQueryParameters", ValueType.MULTIVALUED_TEXT_MAP);
public static final AttributeDescriptor<Integer> REQUEST_TIMEOUT_MILLIS = new AttributeDescriptor<>("requestTimeoutMillis", ValueType.POSITIVE_INTEGER);
- public static final AgentDescriptor<HTTPAgent, HTTPProtocol, HttpClientAgentLink> DESCRIPTOR = new AgentDescriptor<>(
- HTTPAgent.class, HTTPProtocol.class, HttpClientAgentLink.class
+ public static final AgentDescriptor<HTTPAgent, HTTPProtocol, HttpAgentLink> DESCRIPTOR = new AgentDescriptor<>(
+ HTTPAgent.class, HTTPProtocol.class, HttpAgentLink.class
);
/**
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.java
index 1300835ea..9fe587295 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
@@ -115,7 +115,7 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;
* </pre></blockquote>
* Actual body used for the request = "{myObject: {prop1: true, prop2: "test", prop3: {prop4: 1234.4223}}}"
*/
-public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpClientAgentLink> {
+public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpAgentLink> {
public static class HttpClientRequest {
@@ -355,7 +355,7 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpClientAgentLin
}
@Override
- protected void doLinkAttribute(String assetId, Attribute<?> attribute, HttpClientAgentLink agentLink) {
+ protected void doLinkAttribute(String assetId, Attribute<?> attribute, HttpAgentLink agentLink) {
AttributeRef attributeRef = new AttributeRef(assetId, attribute.getName());
String method = agentLink.getMethod().map(Enum::name).orElse(DEFAULT_HTTP_METHOD);
@@ -397,7 +397,7 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpClientAgentLin
}
@Override
- protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, HttpClientAgentLink agentLink) {
+ protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, HttpAgentLink agentLink) {
AttributeRef attributeRef = new AttributeRef(assetId, attribute.getName());
requestMap.remove(attributeRef);
cancelPolling(attributeRef);
@@ -411,7 +411,7 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpClientAgentLin
}
@Override
- protected void doLinkedAttributeWrite(Attribute<?> attribute, HttpClientAgentLink agentLink, AttributeEvent event, Object processedValue) {
+ protected void doLinkedAttributeWrite(Attribute<?> attribute, HttpAgentLink agentLink, AttributeEvent event, Object processedValue) {
HttpClientRequest request = requestMap.get(event.getAttributeRef());
diff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java
index 438f2b644..7ff14fce7 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java
@@ -26,10 +26,10 @@ import org.openremote.model.asset.agent.AgentLink;
import javax.persistence.Entity;
@Entity
-public class SerialAgent extends IOAgent<SerialAgent, SerialClientProtocol, AgentLink.Default> {
+public class SerialAgent extends IOAgent<SerialAgent, SerialProtocol, AgentLink.Default> {
- public static final AgentDescriptor<SerialAgent, SerialClientProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(
- SerialAgent.class, SerialClientProtocol.class, AgentLink.Default.class
+ public static final AgentDescriptor<SerialAgent, SerialProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(
+ SerialAgent.class, SerialProtocol.class, AgentLink.Default.class
);
/**
@@ -43,7 +43,7 @@ public class SerialAgent extends IOAgent<SerialAgent, SerialClientProtocol, Agen
}
@Override
- public SerialClientProtocol getProtocolInstance() {
- return new SerialClientProtocol(this);
+ public SerialProtocol getProtocolInstance() {
+ return new SerialProtocol(this);
}
}
diff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialProtocol.java
similarity index 94%
rename from agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.java
rename to agent/src/main/java/org/openremote/agent/protocol/serial/SerialProtocol.java
index 357124d07..b64accbb9 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialProtocol.java
@@ -44,14 +44,14 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;
* handle the communication and all messages are processed as strings; if you require custom message type handling
* then please sub class the {@link AbstractSerialClientProtocol}).
*/
-public class SerialClientProtocol extends AbstractSerialClientProtocol<SerialClientProtocol, SerialAgent, AgentLink.Default, String, SerialIOClient<String>> {
+public class SerialProtocol extends AbstractSerialClientProtocol<SerialProtocol, SerialAgent, AgentLink.Default, String, SerialIOClient<String>> {
- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, SerialClientProtocol.class);
+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, SerialProtocol.class);
public static final String PROTOCOL_DISPLAY_NAME = "Serial Client";
protected final List<Pair<AttributeRef, Consumer<String>>> protocolMessageConsumers = new ArrayList<>();
- public SerialClientProtocol(SerialAgent agent) {
+ public SerialProtocol(SerialAgent agent) {
super(agent);
}
diff --git a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.java b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.java
index 09b399b74..bc606af99 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.java
@@ -60,9 +60,9 @@ public class SNMPAgent extends Agent<SNMPAgent, SNMPProtocol, SNMPAgent.SNMPAgen
}
}
- public static final ValueDescriptor<SNMPVersion> VALUE_SNMP_VERSION = new ValueDescriptor<>("sNMPVersion", SNMPVersion.class);
+ public static final ValueDescriptor<SNMPVersion> VALUE_SNMP_VERSION = new ValueDescriptor<>("SNMPVersion", SNMPVersion.class);
- public static final AttributeDescriptor<SNMPVersion> SNMP_VERSION = new AttributeDescriptor<>("sNMPVersionValue", VALUE_SNMP_VERSION);
+ public static final AttributeDescriptor<SNMPVersion> SNMP_VERSION = new AttributeDescriptor<>("SNMPVersionValue", VALUE_SNMP_VERSION);
public static final AttributeDescriptor<String> SNMP_BIND_HOST = BIND_HOST.withOptional(false);
public static final AttributeDescriptor<Integer> SNMP_BIND_PORT = BIND_PORT.withOptional(false);
diff --git a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveAgent.java b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveAgent.java
index 9b20dfc04..b1030e143 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveAgent.java
@@ -22,23 +22,24 @@ package org.openremote.agent.protocol.zwave;
import org.openremote.model.asset.agent.Agent;
import org.openremote.model.asset.agent.AgentDescriptor;
import org.openremote.model.asset.agent.AgentLink;
+import org.openremote.model.value.AttributeDescriptor;
import javax.persistence.Entity;
import java.util.Optional;
@Entity
-public class ZWaveAgent extends Agent<ZWaveAgent, ZWaveProtocol, ZWaveAgent.ZWAgentLink> {
+public class ZWaveAgent extends Agent<ZWaveAgent, ZWaveProtocol, ZWaveAgent.ZWaveAgentLink> {
- public static class ZWAgentLink extends AgentLink<ZWAgentLink> {
+ public static class ZWaveAgentLink extends AgentLink<ZWaveAgentLink> {
protected Integer deviceNodeId;
protected Integer deviceEndpoint;
protected String deviceValue;
// For Hydrators
- protected ZWAgentLink() {}
+ protected ZWaveAgentLink() {}
- public ZWAgentLink(String id, Integer deviceNodeId, Integer deviceEndpoint, String deviceValue) {
+ public ZWaveAgentLink(String id, Integer deviceNodeId, Integer deviceEndpoint, String deviceValue) {
super(id);
this.deviceNodeId = deviceNodeId;
this.deviceEndpoint = deviceEndpoint;
@@ -58,8 +59,10 @@ public class ZWaveAgent extends Agent<ZWaveAgent, ZWaveProtocol, ZWaveAgent.ZWAg
}
}
- public static AgentDescriptor<ZWaveAgent, ZWaveProtocol, ZWAgentLink> DESCRIPTOR = new AgentDescriptor<>(
- ZWaveAgent.class, ZWaveProtocol.class, ZWAgentLink.class, null
+ public static final AttributeDescriptor<String> ZWAVE_SERIAL_PORT = SERIAL_PORT.withOptional(false);
+
+ public static AgentDescriptor<ZWaveAgent, ZWaveProtocol, ZWaveAgentLink> DESCRIPTOR = new AgentDescriptor<>(
+ ZWaveAgent.class, ZWaveProtocol.class, ZWaveAgentLink.class, null
);
/**
diff --git a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java
index cc0245f49..1203ae5f0 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java
@@ -221,7 +221,7 @@ public class ZWaveNetwork {
int endpoint = channel.getCommandClass() != null ? channel.getCommandClass().getContext().getDestEndPoint() : 0;
String linkValue = channel.getLinkName();
- ZWaveAgent.ZWAgentLink agentLink = new ZWaveAgent.ZWAgentLink(agentId, nodeId, endpoint, linkValue);
+ ZWaveAgent.ZWaveAgentLink agentLink = new ZWaveAgent.ZWaveAgentLink(agentId, nodeId, endpoint, linkValue);
attribute.addOrReplaceMeta(
new MetaItem<>(AGENT_LINK, agentLink),
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.java
index 30905b9c6..61c239b70 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
@@ -40,7 +40,7 @@ import java.util.logging.Logger;
import static org.openremote.model.asset.agent.AgentLink.getOrThrowAgentLinkProperty;
-public class ZWaveProtocol extends AbstractProtocol<ZWaveAgent, ZWaveAgent.ZWAgentLink> implements ProtocolAssetDiscovery {
+public class ZWaveProtocol extends AbstractProtocol<ZWaveAgent, ZWaveAgent.ZWaveAgentLink> implements ProtocolAssetDiscovery {
// Constants ------------------------------------------------------------------------------------
@@ -90,7 +90,7 @@ public class ZWaveProtocol extends AbstractProtocol<ZWaveAgent, ZWaveAgent.ZWAge
}
@Override
- protected synchronized void doLinkAttribute(String assetId, Attribute<?> attribute, ZWaveAgent.ZWAgentLink agentLink) {
+ protected synchronized void doLinkAttribute(String assetId, Attribute<?> attribute, ZWaveAgent.ZWaveAgentLink agentLink) {
int nodeId = agentLink.getDeviceNodeId().orElse(0);
int endpoint = agentLink.getDeviceEndpoint().orElse(0);
@@ -106,14 +106,14 @@ public class ZWaveProtocol extends AbstractProtocol<ZWaveAgent, ZWaveAgent.ZWAge
}
@Override
- protected synchronized void doUnlinkAttribute(String assetId, Attribute<?> attribute, ZWaveAgent.ZWAgentLink agentLink) {
+ protected synchronized void doUnlinkAttribute(String assetId, Attribute<?> attribute, ZWaveAgent.ZWaveAgentLink agentLink) {
AttributeRef attributeRef = new AttributeRef(assetId, attribute.getName());
Consumer<Value> sensorValueConsumer = sensorValueConsumerMap.remove(attributeRef);
network.removeSensorValueConsumer(sensorValueConsumer);
}
@Override
- protected void doLinkedAttributeWrite(Attribute<?> attribute, ZWaveAgent.ZWAgentLink agentLink, AttributeEvent event, Object processedValue) {
+ protected void doLinkedAttributeWrite(Attribute<?> attribute, ZWaveAgent.ZWaveAgentLink agentLink, AttributeEvent event, Object processedValue) {
int nodeId = getOrThrowAgentLinkProperty(agentLink.getDeviceNodeId(), "device node ID");
int endpoint = getOrThrowAgentLinkProperty(agentLink.getDeviceEndpoint(), "device endpoint");
diff --git a/model/src/main/java/org/openremote/model/asset/agent/AgentDescriptor.java b/model/src/main/java/org/openremote/model/asset/agent/AgentDescriptor.java
index e7b5dadc4..2e10d3fc0 100644
--- a/model/src/main/java/org/openremote/model/asset/agent/AgentDescriptor.java
+++ b/model/src/main/java/org/openremote/model/asset/agent/AgentDescriptor.java
@@ -29,8 +29,6 @@ import org.openremote.model.asset.AssetDescriptor;
import org.openremote.model.protocol.ProtocolAssetDiscovery;
import org.openremote.model.protocol.ProtocolAssetImport;
import org.openremote.model.protocol.ProtocolInstanceDiscovery;
-import org.openremote.model.value.AttributeDescriptor;
-import org.openremote.model.value.MetaItemDescriptor;
/**
* Special type of {@link AssetDescriptor} that describes an agent {@link Asset}.
diff --git a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
index c24930a04..8bef11c7c 100644
--- a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
+++ b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
@@ -19,7 +19,9 @@
*/
package org.openremote.model.asset.agent;
-import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.annotation.JsonPropertyDescription;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.DatabindContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
@@ -42,7 +44,7 @@ import java.util.Optional;
*/
@JsonTypeInfo(property = "type", use = JsonTypeInfo.Id.CUSTOM, defaultImpl = AgentLink.Default.class)
@JsonTypeIdResolver(AgentLink.AgentLinkTypeIdResolver.class)
-public abstract class AgentLink<T extends AgentLink<?>> implements Serializable {
+public abstract class AgentLink<T extends AgentLink<?>> implements Serializable {
/**
* Resolves agent link type as agent type strings using {@link org.openremote.model.util.AssetModelUtil}
diff --git a/model/src/main/java/org/openremote/model/jackson/AssetTypeIdResolver.java b/model/src/main/java/org/openremote/model/jackson/AssetTypeIdResolver.java
index 461edbf07..fa5b3bc92 100644
--- a/model/src/main/java/org/openremote/model/jackson/AssetTypeIdResolver.java
+++ b/model/src/main/java/org/openremote/model/jackson/AssetTypeIdResolver.java
@@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase;
import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetDescriptor;
import org.openremote.model.asset.impl.ThingAsset;
+import org.openremote.model.asset.impl.UnknownAsset;
import org.openremote.model.util.AssetModelUtil;
import java.io.IOException;
@@ -59,7 +60,7 @@ public class AssetTypeIdResolver extends TypeIdResolverBase {
@Override
public JavaType typeFromId(DatabindContext context, String id) throws IOException {
- AssetDescriptor<?> descriptor = AssetModelUtil.getAssetDescriptor(id).orElse(ThingAsset.DESCRIPTOR);
+ AssetDescriptor<?> descriptor = AssetModelUtil.getAssetDescriptor(id).orElse(UnknownAsset.DESCRIPTOR);
return context.constructType(descriptor.getType());
}
}
diff --git a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy
index ed17a320b..0599cafa9 100644
--- a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy
@@ -195,12 +195,12 @@ class GatewayTest extends Specification implements ManagerContainerTrait {
new MetaItem<>(ACCESS_PUBLIC_READ)
),
new Attribute<>("temp", NUMBER).addOrReplaceMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[i-1])
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[i-1])
.setPath("")),
new MetaItem<>(UNITS, units(UNITS_CELSIUS))
),
new Attribute<>("tempSetpoint", NUMBER).addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[i-1])
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[i-1])
.setPath("")),
new MetaItem<>(UNITS, units(UNITS_CELSIUS))
)
@@ -386,12 +386,12 @@ class GatewayTest extends Specification implements ManagerContainerTrait {
new MetaItem<>(ACCESS_PUBLIC_READ)
),
new Attribute<>("temp", NUMBER).addOrReplaceMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[0])
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[0])
.setPath("")),
new MetaItem<>(UNITS, units(UNITS_CELSIUS))
),
new Attribute<>("tempSetpoint", NUMBER).addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[0])
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[0])
.setPath("")),
new MetaItem<>(UNITS, units(UNITS_CELSIUS))
)
@@ -418,7 +418,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {
new Attribute<>("co2Level", POSITIVE_INTEGER, 500)
.addMeta(
new MetaItem<>(UNITS, units(UNITS_PART_PER_MILLION)),
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[0]).setPath(""))
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[0]).setPath(""))
)
)
gatewayClient.sendMessage(SharedEvent.MESSAGE_PREFIX + Values.asJSON(new AssetEvent(AssetEvent.Cause.UPDATE, building1Room5Asset, (String[]) ["name", "attributes"].toArray(new String[0]))).get())
@@ -648,12 +648,12 @@ class GatewayTest extends Specification implements ManagerContainerTrait {
new MetaItem<>(ACCESS_PUBLIC_READ)
),
new Attribute<>("temp", NUMBER).addOrReplaceMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[1])
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[1])
.setPath("")),
new MetaItem<>(UNITS, units(UNITS_CELSIUS))
),
new Attribute<>("tempSetpoint", NUMBER).addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[1])
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agentAssetIds[1])
.setPath("")),
new MetaItem<>(UNITS, units(UNITS_CELSIUS))
)
diff --git a/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy b/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy
index 57a384876..acefed46a 100644
--- a/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy
@@ -112,7 +112,7 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {
.addAttributes(
new Attribute<>("testAttribute", BIG_NUMBER, 100.5, System.currentTimeMillis())
.addOrReplaceMeta(
- new MetaItem<>(MetaItemType.AGENT_LINK, new HTTPAgent.HttpClientAgentLink("http_agent_id")
+ new MetaItem<>(MetaItemType.AGENT_LINK, new HTTPAgent.HttpAgentLink("http_agent_id")
.setPath("test_path")
.setPagingMode(true))
)
@@ -147,7 +147,7 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {
assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).isObject()
assetObjectNode.get("attributes").get("testAttribute").get("value").decimalValue() == 100.5
assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).get("id").asText() == "http_agent_id"
- assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).get("type").asText() == HTTPAgent.HttpClientAgentLink.class.getSimpleName()
+ assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).get("type").asText() == HTTPAgent.HttpAgentLink.class.getSimpleName()
when: "the asset is deserialized"
def asset2 = Values.parse(assetStr, LightAsset.class).orElse(null)
@@ -159,9 +159,9 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {
asset2.getColourRGB().map{it.getR()}.orElse(null) == asset.getColourRGB().map{it.getR()}.orElse(null)
asset2.getColourRGB().map{it.getG()}.orElse(null) == asset.getColourRGB().map{it.getG()}.orElse(null)
asset2.getColourRGB().map{it.getB()}.orElse(null) == asset.getColourRGB().map{it.getB()}.orElse(null)
- asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.orElse(null) instanceof HTTPAgent.HttpClientAgentLink
- asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HTTPAgent.HttpClientAgentLink)it}.flatMap{it.path}.orElse("") == "test_path"
- asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HTTPAgent.HttpClientAgentLink)it}.flatMap{it.pagingMode}.orElse(false)
+ asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.orElse(null) instanceof HTTPAgent.HttpAgentLink
+ asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HTTPAgent.HttpAgentLink)it}.flatMap{it.path}.orElse("") == "test_path"
+ asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HTTPAgent.HttpAgentLink)it}.flatMap{it.pagingMode}.orElse(false)
when: "an attribute is cloned"
def attribute = asset2.getAttribute(LightAsset.COLOUR_RGB).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 0e00c28ce..91ccb840c 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
@@ -286,7 +286,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
// attribute that sends requests to the server using PUT with dynamic body and custom header to override parent
new Attribute<>("putRequestWithHeaders", JSON_OBJECT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent.id)
.setPath("put_request_with_headers")
.setMethod(HTTPMethod.PUT)
.setWriteValue('{"prop1": {$value}, "prop2": "prop2Value"}')
@@ -307,7 +307,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
// attribute that sends requests to the server using GET with dynamic path
new Attribute<>("getRequestWithDynamicPath", BOOLEAN)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent.id)
.setPath('value/{$value}/set')
.setWriteValueConverter((ObjectNode)Values.parse("{\n" +
" \"TRUE\": \"on\",\n" +
@@ -318,7 +318,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
// attribute that polls the server using GET and uses regex filter on response
new Attribute<>("getPollSlow", INTEGER)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent.id)
.setPath("get_poll_slow")
.setPollingMillis(50)
.setValueFilters(
@@ -331,7 +331,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
// attribute that polls the server using GET and uses regex filter on response
new Attribute<>("getPollFast", INTEGER)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent.id)
.setPath("get_poll_fast")
.setPollingMillis(40)
.setValueFilters(
@@ -430,38 +430,38 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr
.addOrReplaceAttributes(
new Attribute<>("getSuccess", TEXT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent2.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent2.id)
.setPath("get_success_200")
)
),
new Attribute<>("getFailure", TEXT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent2.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent2.id)
.setPath("get_failure_401")
)
),
new Attribute<>("pollFailure", TEXT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent3.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent3.id)
.setPath("get_failure_401")
.setPollingMillis(50)
)
),
new Attribute<>("getSuccess2", TEXT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent4.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent4.id)
.setPath("get_success_200")
)
),
new Attribute<>("getFailure2", TEXT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent4.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent4.id)
.setPath("get_failure_401")
)
),
new Attribute<>("getRedirect", TEXT)
.addMeta(
- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent4.id)
+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(agent4.id)
.setPath("redirect")
)
)