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
Added JSON support to Hibernate
Christian Bauerbc4e8a418540
diff --git a/container/src/main/java/org/openremote/container/Constants.java b/container/src/main/java/org/openremote/container/Constants.javaindex dc4826161..21d64959b 100644--- a/container/src/main/java/org/openremote/container/Constants.java+++ b/container/src/main/java/org/openremote/container/Constants.java@@ -21,5 +21,6 @@ package org.openremote.container;public interface Constants {- String PERSISTENCE_ID_GENERATOR = "ID_GENERATOR";+ String PERSISTENCE_SEQUENCE_ID_GENERATOR = "SEQUENCE_ID_GENERATOR";+ String PERSISTENCE_UNIQUE_ID_GENERATOR = "UNIQUE_ID_GENERATOR";}diff --git a/container/src/main/java/org/openremote/container/json/JsonStringSqlTypeDescriptor.java b/container/src/main/java/org/openremote/container/json/JsonStringSqlTypeDescriptor.javanew file mode 100644index 000000000..9acea1d6f--- /dev/null+++ b/container/src/main/java/org/openremote/container/json/JsonStringSqlTypeDescriptor.java@@ -0,0 +1,79 @@+/*+ * Copyright 2016, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * 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.container.json;++import org.hibernate.type.descriptor.ValueBinder;+import org.hibernate.type.descriptor.ValueExtractor;+import org.hibernate.type.descriptor.WrapperOptions;+import org.hibernate.type.descriptor.java.JavaTypeDescriptor;+import org.hibernate.type.descriptor.sql.BasicBinder;+import org.hibernate.type.descriptor.sql.BasicExtractor;+import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;++import java.sql.*;++public class JsonStringSqlTypeDescriptor implements SqlTypeDescriptor {++ public static final JsonStringSqlTypeDescriptor INSTANCE = new JsonStringSqlTypeDescriptor();++ @Override+ public int getSqlType() {+ return Types.OTHER;+ }++ @Override+ public boolean canBeRemapped() {+ return true;+ }++ @Override+ public <X> ValueExtractor<X> getExtractor(JavaTypeDescriptor<X> javaTypeDescriptor) {+ return new BasicExtractor<X>(javaTypeDescriptor, this) {+ @Override+ protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {+ return javaTypeDescriptor.wrap(rs.getObject(name), options);+ }++ @Override+ protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {+ return javaTypeDescriptor.wrap(statement.getObject(index), options);+ }++ @Override+ protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {+ return javaTypeDescriptor.wrap(statement.getObject(name), options);+ }+ };+ }+++ @Override+ public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor) {+ return new BasicBinder<X>(javaTypeDescriptor, this) {+ @Override+ protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {+ st.setString(+ index,+ javaTypeDescriptor.unwrap(value, String.class, options)+ );+ }+ };+ }+}\ No newline at end of filediff --git a/container/src/main/java/org/openremote/container/json/JsonStringType.java b/container/src/main/java/org/openremote/container/json/JsonStringType.javanew file mode 100644index 000000000..269f8f1a4--- /dev/null+++ b/container/src/main/java/org/openremote/container/json/JsonStringType.java@@ -0,0 +1,40 @@+/*+ * Copyright 2016, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * 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.container.json;++import elemental.json.JsonValue;+import org.hibernate.type.AbstractSingleColumnStandardBasicType;++public class JsonStringType extends AbstractSingleColumnStandardBasicType<JsonValue> {++ public JsonStringType() {+ super(JsonStringSqlTypeDescriptor.INSTANCE, new JsonTypeDescriptor());+ }++ public String getName() {+ return "json";+ }++ @Override+ protected boolean registerUnderJavaType() {+ return true;+ }++}\ No newline at end of filediff --git a/container/src/main/java/org/openremote/container/json/JsonTypeDescriptor.java b/container/src/main/java/org/openremote/container/json/JsonTypeDescriptor.javanew file mode 100644index 000000000..5d9635eca--- /dev/null+++ b/container/src/main/java/org/openremote/container/json/JsonTypeDescriptor.java@@ -0,0 +1,80 @@+/*+ * Copyright 2016, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * 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.container.json;++import elemental.json.JsonValue;+import elemental.json.impl.JsonUtil;+import org.hibernate.type.descriptor.WrapperOptions;+import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;+import org.hibernate.type.descriptor.java.MutableMutabilityPlan;++public class JsonTypeDescriptor extends AbstractTypeDescriptor<JsonValue> {++ public JsonTypeDescriptor() {+ super(JsonValue.class, new MutableMutabilityPlan<JsonValue>() {+ @Override+ protected JsonValue deepCopyNotNull(JsonValue value) {+ return JsonUtil.parse(value.toJson());+ }+ });+ }++ @Override+ public boolean areEqual(JsonValue one, JsonValue another) {+ if (one == another) {+ return true;+ }+ if (one == null || another == null) {+ return false;+ }+ return one.toJson().equals(another.toJson());+ }++ @Override+ public String toString(JsonValue value) {+ return value.toJson();+ }++ @Override+ public JsonValue fromString(String string) {+ return JsonUtil.parse(string);+ }++ @SuppressWarnings({"unchecked"})+ @Override+ public <X> X unwrap(JsonValue value, Class<X> type, WrapperOptions options) {+ if (value == null) {+ return null;+ }+ if (String.class.isAssignableFrom(type)) {+ return (X) toString(value);+ }+ throw unknownUnwrap(type);+ }++ @Override+ public <X> JsonValue wrap(X value, WrapperOptions options) {+ if (value == null) {+ return null;+ }+ return fromString(value.toString());+ }++}\ No newline at end of filediff --git a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java b/container/src/main/java/org/openremote/container/persistence/PersistenceService.javaindex 9115f791d..df7e38c40 100644--- a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java+++ b/container/src/main/java/org/openremote/container/persistence/PersistenceService.java@@ -46,6 +46,8 @@ public class PersistenceService implements ContainerService {public static final int DATABASE_MIN_POOL_SIZE_DEFAULT = 5;public static final String DATABASE_MAX_POOL_SIZE = "DATABASE_MAX_POOL_SIZE";public static final int DATABASE_MAX_POOL_SIZE_DEFAULT = 20;+ public static final String DATABASE_CREATE_SCHEMA = "DATABASE_CREATE_SCHEMA";+ public static final boolean DATABASE_CREATE_SCHEMA_DEFAULT = false;protected Database database;protected String persistenceUnitName;@@ -78,6 +80,13 @@ public class PersistenceService implements ContainerService {public void start(Container container) throws Exception {this.entityManagerFactory =Persistence.createEntityManagerFactory(persistenceUnitName, persistenceUnitProperties);++ if (container.isDevMode()+ || container.getConfigBoolean(DATABASE_CREATE_SCHEMA, DATABASE_CREATE_SCHEMA_DEFAULT)) {+ LOG.info("Dropping and re-creating database schema");+ dropSchema();+ createSchema();+ }}@Overridediff --git a/container/src/main/java/org/openremote/container/persistence/UniqueIdentifierGenerator.java b/container/src/main/java/org/openremote/container/persistence/UniqueIdentifierGenerator.javanew file mode 100644index 000000000..75d7d74ff--- /dev/null+++ b/container/src/main/java/org/openremote/container/persistence/UniqueIdentifierGenerator.java@@ -0,0 +1,16 @@+package org.openremote.container.persistence;++import org.hibernate.HibernateException;+import org.hibernate.engine.spi.SessionImplementor;+import org.hibernate.id.IdentifierGenerator;+import org.openremote.container.util.IdentifierUtil;++import java.io.Serializable;++public class UniqueIdentifierGenerator implements IdentifierGenerator {++ @Override+ public Serializable generate(SessionImplementor session, Object object) throws HibernateException {+ return IdentifierUtil.generateGlobalUniqueId();+ }+}diff --git a/container/src/main/java/org/openremote/container/persistence/package-info.java b/container/src/main/java/org/openremote/container/persistence/package-info.javaindex 55fe9ca0e..cfbb32b66 100644--- a/container/src/main/java/org/openremote/container/persistence/package-info.java+++ b/container/src/main/java/org/openremote/container/persistence/package-info.java@@ -1,17 +1,31 @@- name = Constants.PERSISTENCE_ID_GENERATOR,- strategy = "enhanced-sequence",- parameters = {- @org.hibernate.annotations.Parameter(- name = "sequence_name",- value = "OR_MANAGER_SEQUENCE"- ),- @org.hibernate.annotations.Parameter(- name = "initial_value",- value = "1000"- )- }-)+ @org.hibernate.annotations.GenericGenerator(+ name = Constants.PERSISTENCE_SEQUENCE_ID_GENERATOR,+ strategy = "enhanced-sequence",+ parameters = {+ @org.hibernate.annotations.Parameter(+ name = "sequence_name",+ value = "OR_MANAGER_SEQUENCE"+ ),+ @org.hibernate.annotations.Parameter(+ name = "initial_value",+ value = "1000"+ )+ }),+ @org.hibernate.annotations.GenericGenerator(+ name = Constants.PERSISTENCE_UNIQUE_ID_GENERATOR,+ strategy = "org.openremote.container.persistence.UniqueIdentifierGenerator"+ )+})++ @org.hibernate.annotations.TypeDef(+ name = "json",+ typeClass = JsonStringType.class+ )+})+package org.openremote.container.persistence;-import org.openremote.container.Constants;\ No newline at end of file+import org.openremote.container.Constants;+import org.openremote.container.json.JsonStringType;diff --git a/manager/server/src/main/java/org/openremote/manager/server/SampleDataService.java b/manager/server/src/main/java/org/openremote/manager/server/SampleDataService.javaindex 71f6d0a3b..38b377e46 100644--- a/manager/server/src/main/java/org/openremote/manager/server/SampleDataService.java+++ b/manager/server/src/main/java/org/openremote/manager/server/SampleDataService.java@@ -19,18 +19,24 @@*/package org.openremote.manager.server;+import elemental.json.Json;+import elemental.json.JsonObject;import org.apache.log4j.Logger;import org.keycloak.admin.client.resource.*;import org.keycloak.common.enums.SslRequired;import org.keycloak.representations.idm.*;import org.openremote.container.Container;import org.openremote.container.ContainerService;+import org.openremote.container.persistence.PersistenceService;import org.openremote.container.security.AuthForm;import org.openremote.manager.server.agent.AgentService;import org.openremote.manager.server.agent.ConnectorService;import org.openremote.manager.server.security.ManagerIdentityService;+import org.openremote.manager.shared.agent.PersistentAgent;import rx.Observable;+import javax.persistence.EntityManager;+import javax.persistence.EntityTransaction;import javax.ws.rs.core.UriBuilder;import java.util.ArrayList;import java.util.Arrays;@@ -49,15 +55,14 @@ public class SampleDataService implements ContainerService {public static final String ADMIN_CLI_CLIENT_ID = "admin-cli";public static final String ADMIN_PASSWORD = "admin";+ protected PersistenceService persistenceService;protected ManagerIdentityService identityService;protected ConnectorService connectorService;protected AgentService agentService;- /* TODO- protected PersistenceService persistenceService- */@Overridepublic void init(Container container) throws Exception {+ persistenceService = container.getService(PersistenceService.class);identityService = container.getService(ManagerIdentityService.class);connectorService = container.getService(ConnectorService.class);agentService = container.getService(AgentService.class);@@ -86,14 +91,14 @@ public class SampleDataService implements ContainerService {registerClientApplications(accessToken);addRolesAndTestUsers(accessToken);- /* TODO- persistenceService.createSchema();EntityManager em = persistenceService.getEntityManagerFactory().createEntityManager();EntityTransaction tx = em.getTransaction();tx.begin();- em.persist(someSampleData);++ storeSampleAgent(em);+tx.commit();- */+ em.close();}@Override@@ -237,4 +242,30 @@ public class SampleDataService implements ContainerService {));}++ protected void storeSampleAgent(EntityManager em) {+ PersistentAgent controller2Agent = new PersistentAgent();+ controller2Agent.setName("OpenRemote Controller2 Test Agent");+ controller2Agent.setDescription("A test agent for OpenRemote Controller version 2.x");+ controller2Agent.setEnabled(true);+ controller2Agent.setConnectorType("urn:openremote:connector:controller2");++ JsonObject connectorSettings = Json.createObject();+ connectorSettings.put("host", Json.create("192.168.0.0"));+ connectorSettings.put("port", Json.create(8080));+ controller2Agent.setConnectorSettings(connectorSettings);++ em.persist(controller2Agent);++ // TODO Remove this test+ List hosts = em.createNativeQuery(+ "SELECT a.CONNECTOR_SETTINGS -> \"$.host\" " ++ "FROM AGENT a " ++ "WHERE JSON_EXTRACT(a.CONNECTOR_SETTINGS, \"$.port\") = 8080")+ .getResultList();++ for (Object host : hosts) {+ LOG.info("### GOT: " + host);+ }+ }}diff --git a/manager/server/src/main/resources/META-INF/persistence.xml b/manager/server/src/main/resources/META-INF/persistence.xmlindex d17bcd180..428b895cf 100644--- a/manager/server/src/main/resources/META-INF/persistence.xml+++ b/manager/server/src/main/resources/META-INF/persistence.xml@@ -9,9 +9,7 @@<class>org.openremote.container.persistence</class>- <!-- TODO- <class>org.openremote.manager.shared.model.Foo</class>- -->+ <class>org.openremote.manager.shared.agent.PersistentAgent</class><exclude-unlisted-classes>true</exclude-unlisted-classes><properties>diff --git a/manager/server/src/main/resources/logging.properties b/manager/server/src/main/resources/logging.propertiesindex 8dfef0794..6e1b9d3cb 100644--- a/manager/server/src/main/resources/logging.properties+++ b/manager/server/src/main/resources/logging.properties@@ -19,3 +19,7 @@ org.apache.camel.impl.converter.DefaultTypeConverter.level=WARNING# Set this to FINEST to log outgoing HTTP trafficorg.apache.http.level=WARNINGorg.apache.http.impl.conn.DefaultClientConnection.level=WARNING++# Set this to FINEST to log SQL execution+org.hibernate.SQL.level=FINEST+org.hibernate.type.descriptor.sql.BasicBinder.level=FINESTdiff --git a/manager/shared/build.gradle b/manager/shared/build.gradleindex 0c1fb8040..1492ae202 100644--- a/manager/shared/build.gradle+++ b/manager/shared/build.gradle@@ -11,6 +11,7 @@ dependencies {compile "org.keycloak:keycloak-core:$keycloakVersion"compile "org.keycloak:keycloak-core:$keycloakVersion:sources"compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"+ compile "org.hibernate:hibernate-entitymanager:$hibernateVersion"compile "de.grundid.opendatalab:geojson-jackson:$geojsonJacksonVersion"compile "de.grundid.opendatalab:geojson-jackson:$geojsonJacksonVersion:sources"diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/Constants.java b/manager/shared/src/main/java/org/openremote/manager/shared/Constants.javaindex d5adef4e4..d4a598d83 100644--- a/manager/shared/src/main/java/org/openremote/manager/shared/Constants.java+++ b/manager/shared/src/main/java/org/openremote/manager/shared/Constants.java@@ -25,4 +25,6 @@ public interface Constants {String MANAGER_CLIENT_ID = "or-manager";String MASTER_REALM = "master";String MASTER_REALM_ADMIN_USER = "admin";+ String PERSISTENCE_SEQUENCE_ID_GENERATOR = "SEQUENCE_ID_GENERATOR";+ String PERSISTENCE_UNIQUE_ID_GENERATOR = "UNIQUE_ID_GENERATOR";}diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/Identifiable.java b/manager/shared/src/main/java/org/openremote/manager/shared/Identifiable.javadeleted file mode 100644index 92542fbef..000000000--- a/manager/shared/src/main/java/org/openremote/manager/shared/Identifiable.java+++ /dev/null@@ -1,89 +0,0 @@-/*- * Copyright 2016, OpenRemote Inc.- *- * See the CONTRIBUTORS.txt file in the distribution for a- * full listing of individual contributors.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * 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.manager.shared;--import jsinterop.annotations.JsIgnore;-import jsinterop.annotations.JsType;--import javax.persistence.Column;-import javax.persistence.Id;-import javax.persistence.MappedSuperclass;-import javax.validation.constraints.NotNull;-import javax.validation.constraints.Size;--@JsType-@MappedSuperclass-public abstract class Identifiable {-- @Id- @Column(name = "ID")- public String id;-- @NotNull- @Size(min = 3, max = 255)- @Column(name = "MODEL_TYPE")- public String type; // URI-- @JsIgnore- protected Identifiable() {- }-- @JsIgnore- public Identifiable(String id, String type) {- this.id = id;- this.type = type;- }-- public String getId() {- return id;- }-- public void setId(String id) {- this.id = id;- }-- public String getType() {- return type;- }-- public boolean isOfType(String type) {- return getType().equals(type);- }-- @Override- public boolean equals(Object o) {- if (this == o) return true;- if (o == null || getClass() != o.getClass()) return false;-- Identifiable that = (Identifiable) o;-- return getId().equals(that.getId());- }-- @Override- public int hashCode() {- return id.hashCode();- }-- public String toTypeIdString() {- return type + ':' + id;- }--}diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/agent/PersistentAgent.java b/manager/shared/src/main/java/org/openremote/manager/shared/agent/PersistentAgent.javanew file mode 100644index 000000000..0c1bde643--- /dev/null+++ b/manager/shared/src/main/java/org/openremote/manager/shared/agent/PersistentAgent.java@@ -0,0 +1,121 @@+package org.openremote.manager.shared.agent;++import elemental.json.JsonObject;++import javax.persistence.*;+import javax.validation.constraints.NotNull;++import java.util.Date;++import static org.openremote.manager.shared.Constants.PERSISTENCE_UNIQUE_ID_GENERATOR;++@Entity+@Table(name = "AGENT")+public class PersistentAgent {++ public static final String NO_CONNECTOR_ASSIGNED_TYPE = "urn:openremote:connector:none";+ public static final String NO_DESCRIPTION = "-";++ @Id+ @Column(name = "ID", length = 22)+ @GeneratedValue(generator = PERSISTENCE_UNIQUE_ID_GENERATOR)+ protected String id;++ @Version+ @Column(name = "OBJ_VERSION")+ protected long version;++ @Temporal(TemporalType.TIMESTAMP)+ @Column(name = "CREATED_ON", updatable = false, nullable = false)+ @org.hibernate.annotations.CreationTimestamp+ protected Date createdOn;++ @NotNull+ @Column(name = "NAME")+ protected String name;++ @NotNull+ @Column(name = "DESCRIPTION")+ protected String description = NO_DESCRIPTION;++ @NotNull+ @Column(name = "ENABLED")+ protected boolean enabled;++ @NotNull+ @Column(name = "CONNECTOR_TYPE")+ protected String connectorType = NO_CONNECTOR_ASSIGNED_TYPE;++ @Column(name = "CONNECTOR_SETTINGS", columnDefinition = "json")+ @org.hibernate.annotations.Type(type = "json")+ protected JsonObject connectorSettings;++ public PersistentAgent() {+ }++ public String getId() {+ return id;+ }++ public void setId(String id) {+ this.id = id;+ }++ public long getVersion() {+ return version;+ }++ public Date getCreatedOn() {+ return createdOn;+ }++ public String getName() {+ return name;+ }++ public void setName(String name) {+ this.name = name;+ }++ public String getDescription() {+ return description;+ }++ public void setDescription(String description) {+ this.description = description;+ }++ public boolean isEnabled() {+ return enabled;+ }++ public void setEnabled(boolean enabled) {+ this.enabled = enabled;+ }++ public String getConnectorType() {+ return connectorType;+ }++ public void setConnectorType(String connectorType) {+ this.connectorType = connectorType;+ }++ public JsonObject getConnectorSettings() {+ return connectorSettings;+ }++ public void setConnectorSettings(JsonObject connectorSettings) {+ this.connectorSettings = connectorSettings;+ }++ @Override+ public String toString() {+ return getClass().getSimpleName() + "{" ++ "id='" + id + '\'' ++ ", name='" + name + '\'' ++ ", enabled=" + enabled ++ ", connectorType='" + connectorType + '\'' ++ '}';+ }+}diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetsModelTest.groovy b/test/src/test/groovy/org/openremote/test/ngsi/EntityModelTest.groovysimilarity index 98%rename from test/src/test/groovy/org/openremote/test/assets/AssetsModelTest.groovyrename to test/src/test/groovy/org/openremote/test/ngsi/EntityModelTest.groovyindex 932c6262b..e0cef06c3 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetsModelTest.groovy+++ b/test/src/test/groovy/org/openremote/test/ngsi/EntityModelTest.groovy@@ -1,4 +1,4 @@-package org.openremote.test.assets+package org.openremote.test.ngsiimport elemental.json.Jsonimport elemental.json.JsonObject@@ -9,7 +9,7 @@ import org.openremote.manager.shared.ngsi.Modelimport org.openremote.manager.shared.ngsi.ModelValidationErrorimport spock.lang.Specification-class AssetsModelTest extends Specification {+class EntityModelTest extends Specification {def "Invalid characters in NGSI fields"() {expect: "number of validation errors"