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
Class name cleanup
Rich Turner9f3a2f1b7384
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.javaindex cf80e87f7..7c84ab61f 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.HttpAgentLink> {+public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HTTPAgentLink> {- public static class HttpAgentLink extends AgentLink<HttpAgentLink> {+ 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.HttpAgenprotected String pollingAttribute;// For Hydrators- protected HttpAgentLink() {}+ protected HTTPAgentLink() {}- public HttpAgentLink(String id) {+ public HTTPAgentLink(String id) {super(id);}@@ -56,7 +56,7 @@ public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpAgenreturn Optional.ofNullable(headers);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(queryParameters);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(pollingMillis);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(pagingMode);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(path);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(method);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(contentType);}- public HttpAgentLink 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.HttpAgenreturn Optional.ofNullable(pollingAttribute);}- public HttpAgentLink 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.HttpAgenpublic 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, HttpAgentLink> DESCRIPTOR = new AgentDescriptor<>(- HTTPAgent.class, HTTPProtocol.class, HttpAgentLink.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.javaindex 9fe587295..701469e23 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, HttpAgentLink> {+public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {public static class HttpClientRequest {@@ -355,7 +355,7 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpAgentLink> {}@Override- protected void doLinkAttribute(String assetId, Attribute<?> attribute, HttpAgentLink 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, HttpAgentLink> {}@Override- protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, HttpAgentLink 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, HttpAgentLink> {}@Override- protected void doLinkedAttributeWrite(Attribute<?> attribute, HttpAgentLink 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/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovyindex 0599cafa9..19598e336 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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.groovyindex acefed46a..2bab514ec 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.HttpAgentLink("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.5assetObjectNode.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.HttpAgentLink.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.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)+ 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.groovyindex 91ccb840c..6adf10431 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 parentnew Attribute<>("putRequestWithHeaders", JSON_OBJECT).addMeta(- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(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 pathnew Attribute<>("getRequestWithDynamicPath", BOOLEAN).addMeta(- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(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 responsenew Attribute<>("getPollSlow", INTEGER).addMeta(- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(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 responsenew Attribute<>("getPollFast", INTEGER).addMeta(- new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(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.HttpAgentLink(agent4.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HTTPAgentLink(agent4.id).setPath("redirect")))