diff --git a/.gencode_hash.txt b/.gencode_hash.txt index fb7cb6c8fa..131fb598d0 100644 --- a/.gencode_hash.txt +++ b/.gencode_hash.txt @@ -1,9 +1,9 @@ -909b90e19ba41e691ea277eb26ff8a3b7d7bad43ecd7ac082683e97401bde9b5 gencode/docs/cloud_iot_config.html b35646a2f3d7c30fd34e3ea6ab6a1070b39c469fd1de49cab1093ff32faaf06d gencode/docs/command_discovery.html e1f62882576d0f4332360f2aedb79b37a43973fb31d862c829af924f8f310ec1 gencode/docs/command_mapping.html 5513a43ef916d0413de0c95aede03042ce8824e98fbb8f3634c12f5dee53cce8 gencode/docs/config.html 30c7f39e50e290b0a36a3414cf1c90277ebd249f126f85f0a307bc7b74164e08 gencode/docs/config_mapping.html 5598402bde04860394d91ecf43f5c653ff539cce49d011db4b5b17d596b72c2a gencode/docs/configuration_endpoint.html +b7ca70e3176f997f254c32bd8d53dff1462ac8a71c0e166aaa85193d67bff60b gencode/docs/configuration_execution.html 00e8646fd8117d47ddf32f2488228cd35b66fd711cb21288dc6bb5a5715978cb gencode/docs/configuration_pubber.html 82fbf41e4e88593f22a929fc8ade4d1e8f75a0fc1aa8452ea1d3b19023bee314 gencode/docs/envelope.html f1fde870638541bea6de16acd64365c89a7d56ee3270d6fd1bcdbb5bdb141887 gencode/docs/event.html @@ -15,7 +15,7 @@ a8800ab8384de3b846af0d72cf310acf01644842b557e42eec20b69a0bfa1868 gencode/docs/e 9ae793a641f2e053c5af734bf813cd2637a675330acb8d9e903ef03b4286e007 gencode/docs/metadata.html e101ec26541b7787fa722244fed744713d05649de547160f39744e1e61850ddd gencode/docs/persistent_device.html 5d039d607af9ec75ee552dfe36b16c702687ea16f5663f41fc49b4533b86e00d gencode/docs/properties.html -846eaf1735bd2506357173cfc720c8674d95acf2d20e19f37e3d34cad0a345d2 gencode/docs/readme.md +392f272c1c8cd047eb6906f2f11ffacc7083c32f639da2437d6a9ca861062ecc gencode/docs/readme.md 690d56e96c4e180e49e0abcba358ab1842ea06dd3f693918852a9de370c994d5 gencode/docs/reflect_config.html 9332e44c87dae9261b079424e748d5ee1df08a3c6b39987d254ebf78274e2f34 gencode/docs/reflect_state.html 741b880216be3743f6747800a042f2dbd89f3b0344c6b0a965f4bc010f03a930 gencode/docs/schema_doc.css @@ -32,7 +32,6 @@ b9f903444ab08907e41eb123286434ff3207b1edd01397af3ddefb8475bbdadc gencode/java/u fcbed49f1af8b791d8c52bcbe18f65521a79d9ac3eb33ec3afd9b342ab2bfc56 gencode/java/udmi/schema/BlobsetState.java 0a4f6bcd5065418c1cdc6c05b900b3de31744847d25b6ab6de7aabb1e724710e gencode/java/udmi/schema/BuildingTranslation.java b95ab79a531c917a5004b5e5bc70e010b33d5d6ff53be09e5dbf2d1df479b569 gencode/java/udmi/schema/Category.java -d6875f63ce67d1b945a0b75a4a660bd083cc52492371a7350c4109f6bf54968b gencode/java/udmi/schema/CloudIotConfig.java a2eeff86f4302272736d84602e2ca36a64d27c8ef6761cc05ffb8ad17b030d4d gencode/java/udmi/schema/CloudModel.java ff79de9390aa25bb45fb3e2ebb682c865ccab764f56d9644377d9d28c0ab10e4 gencode/java/udmi/schema/Config.java 10d67bf2080403fd196f63097e4ce2151edaafe3cf4ac77598ef83e06f94cb05 gencode/java/udmi/schema/DeviceMappingConfig.java @@ -48,6 +47,7 @@ b90ab40a281c5e383881629bd8a791ba3d30491e06ebc623a476e2735a3f6c3a gencode/java/u 885859ea9de29217186c34f3a90b112411d1beddaf58a88b85e7934cd3c92b6f gencode/java/udmi/schema/Entry.java 9b92e03774ed0b9159ff3ab462822699ef7f824161b166a881889ea1eb6a62ad gencode/java/udmi/schema/Envelope.java e9f5c77be81486b6b8c6d88f70f2d50583d8c3fafa2ac09ead80f44b8d5e751e gencode/java/udmi/schema/Event.java +69c3c12ce057b6ab8e27ab8cab6fb009bfd1c997652214b49e6f2a26a58f302c gencode/java/udmi/schema/ExecutionConfiguration.java 2e77a29988e6c17875d3f781be931e3b835bb310639f60d3bb28f24405a86bed gencode/java/udmi/schema/FamilyDiscoveryConfig.java ae4a645f199c8e24b3303463d428ca17af7603ae9ae9238397a6a82e752ab454 gencode/java/udmi/schema/FamilyDiscoveryEvent.java 0afc15acd72874e5a0c47f546abc0c4569f5bc37838fdcac77bc7bd55cc53a6d gencode/java/udmi/schema/FamilyDiscoveryState.java @@ -98,12 +98,11 @@ d3968b92497e83a63f18cc0e74484a9807f1bb92db0c92d556ec2caaa143d645 gencode/java/u ac6f8fd87c8986cce01e872460c15ff6fe71e3816f9bde610acfe25f7d38c8d4 gencode/java/udmi/schema/ValidationEvent.java f7d117dc8b9764acf0c95a13a2bfdfbdf31d1a8ec83a707448aa4d7391ef07e2 gencode/java/udmi/schema/ValidationState.java e007ddd1ceeae3603c85110c33e1bb4a418ff9c7a791ca0df25b7ea3caeafd36 gencode/java/udmi/schema/ValidationSummary.java -0601b86702f0e8959a391342307cd782be91e7dcfa0017089230a38e76661dd5 gencode/python/udmi/schema/__init__.py +67256cd379f8b456a2d8c3b5e64c9bde740569338f8e32be626ecb65ad6fd23c gencode/python/udmi/schema/__init__.py 4b25dd95f863059b761269f93adcae7049507924a1c6e74d6856849203c179db gencode/python/udmi/schema/ancillary_properties.py 5ecd6c542f33450cb4ce75d940a6dff4d3bd67d4b9de4aff5ee88abcc301dbff gencode/python/udmi/schema/building_config.py dab4f5fca272ec48c2881bca2b6bc43786ada47fa1f6dd935c35f7ce0eb6b0f6 gencode/python/udmi/schema/building_translation.py c33fab16eb86b93692ddbb243a2d6cfe202ca1a0fd76b351a18727a35940d958 gencode/python/udmi/schema/category.py -a61b1c5732f01b7efda41a773d5786fad755f371193ce4478b458387ca2a8fe8 gencode/python/udmi/schema/cloud_iot_config.py 6578d68f65b87b781086e72566de910db4bef365599fe3188862d4d8a81e84fb gencode/python/udmi/schema/command_discovery.py 1254c34d973c9099ae99dcea4534e234e9019f49255e2e27d2afa1bc074fd596 gencode/python/udmi/schema/command_mapping.py c5a62f92328e2ede167fc1f53bece6e48696a0ab0e37e3a41f65cd98494ba0d7 gencode/python/udmi/schema/common.py @@ -121,6 +120,7 @@ ac3facbd96f7cb2f7e387e7497d6a36af379a2687329571f250c5670f9933244 gencode/python ba37d2d54df565aba42ef055a0ec961175d180c2e8092a914e62029bc5388857 gencode/python/udmi/schema/config_system.py 97c2e5fadc6da0d84660f3296de885ab59f4b04154179b6717f77ec366f1544b gencode/python/udmi/schema/config_system_testing.py 4637fc257ea4d6ea5a46d98db69c57e27e4ecbf5d86f77036cd1382f1a40f532 gencode/python/udmi/schema/configuration_endpoint.py +e8a1574074554b6144b178d2adedc76a1c7be5ae911b253deff4460d8d82c6ee gencode/python/udmi/schema/configuration_execution.py 3814c88403934dbd3fce77d92a8ad45c68dc7e07c319ba9b4e8f1b1ac7518c07 gencode/python/udmi/schema/configuration_pubber.py 998ce105f88686f27b85f3630a396ed04b106f830c133a684ea5c505ca95b1c3 gencode/python/udmi/schema/envelope.py 1eb9019b9d0b4ff7de2df8beb625a4f89292d636ece0c02f160495c537bd6c2c gencode/python/udmi/schema/event.py diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 08b8b2867b..064bae8d58 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -135,6 +135,10 @@ jobs: cd sites/udmi_site_model/out echo Output from `pwd` more `find out -type f` + - name: validator logs + if: ${{ always() }} + run: | + cat out/validator.out || true - name: pubber logs if: ${{ always() }} run: | diff --git a/bin/test_trace b/bin/test_trace index 194a558271..788531fddc 100755 --- a/bin/test_trace +++ b/bin/test_trace @@ -20,6 +20,7 @@ echo for file in `find $site_out -type f`; do sed -E -i $file \ -e "s/[0-9-]{10}T[0-9:]{8}Z/1999-10-20T01:02:03Z/" \ + -e "s/Validator.java:[0-9]+/redacted/" \ -e 's/\\t[a-zA-Z .()$0-9]+\.java:[0-9]+\)\\n/\\tredacted\\n/g' done diff --git a/bin/test_validator b/bin/test_validator index 1c55336d7c..308f95a2c1 100755 --- a/bin/test_validator +++ b/bin/test_validator @@ -116,4 +116,5 @@ echo Found out files $outfiles, copying to $TMP_VALIDATOR # Include /dev/null so that more has >1 to chomp on and outputs headers. more /dev/null $outfiles | sed -E >> $TMP_VALIDATOR \ -e "s/[0-9-]{10}T[0-9:]{8}Z/1999-10-20T01:02:03Z/" \ + -e "s/Validator.java:[0-9]+/redacted/" \ -e 's/\\t[a-zA-Z .()$0-9]+\.java:[0-9]+\)\\n/\\tredacted\\n/g' \ diff --git a/bin/validator b/bin/validator index 65055f3563..92e2abe554 100755 --- a/bin/validator +++ b/bin/validator @@ -20,9 +20,6 @@ if [ ! -f $site_path/cloud_iot_config.json ]; then false fi -echo Building validator... -$ROOT_DIR/validator/bin/build > /dev/null - echo Running tools version `(cd $ROOT_DIR; git describe)` if [[ -n $subscription ]]; then diff --git a/validator/src/main/java/com/google/daq/mqtt/validator/CleanDateFormat.java b/common/src/main/java/com/google/udmi/util/CleanDateFormat.java similarity index 97% rename from validator/src/main/java/com/google/daq/mqtt/validator/CleanDateFormat.java rename to common/src/main/java/com/google/udmi/util/CleanDateFormat.java index f9b97f94c5..2b7b4ddd44 100644 --- a/validator/src/main/java/com/google/daq/mqtt/validator/CleanDateFormat.java +++ b/common/src/main/java/com/google/udmi/util/CleanDateFormat.java @@ -1,4 +1,4 @@ -package com.google.daq.mqtt.validator; +package com.google.udmi.util; import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import java.text.ParseException; diff --git a/common/src/main/java/com/google/udmi/util/GeneralUtils.java b/common/src/main/java/com/google/udmi/util/GeneralUtils.java index 8599b02f20..c0db3dddcb 100644 --- a/common/src/main/java/com/google/udmi/util/GeneralUtils.java +++ b/common/src/main/java/com/google/udmi/util/GeneralUtils.java @@ -8,6 +8,7 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; +import java.util.Map; public class GeneralUtils { @@ -76,12 +77,38 @@ public static void toJsonFile(File file, Object target) { } } - public static T deepCopy(T endpoint1, Class valueType) { + public static T deepCopy(T object) { + Class targetClass = object.getClass(); try { - return OBJECT_MAPPER.readValue(toJsonString(endpoint1), - valueType); + @SuppressWarnings("unchecked") + T t = (T) OBJECT_MAPPER.readValue(toJsonString(object), targetClass); + return t; } catch (Exception e) { - throw new RuntimeException("While making deep copy of " + valueType.getName(), e); + throw new RuntimeException("While making deep copy of " + targetClass.getName(), e); + } + } + + public static T mergeObject(Object destination, Object source) { + Map target = JsonUtil.asMap(destination); + mergeObject(target, JsonUtil.asMap(source)); + @SuppressWarnings("unchecked") + T t = (T) JsonUtil.convertTo(destination.getClass(), target); + return t; + } + + public static void mergeObject(Map target, Map source) { + for (String key : source.keySet()) { + Object targetValue = target.get(key); + Object sourceValue = source.get(key); + if (targetValue instanceof Map && sourceValue instanceof Map) { + @SuppressWarnings("unchecked") + Map castTarget = (Map) targetValue; + @SuppressWarnings("unchecked") + Map castSource = (Map) sourceValue; + mergeObject(castTarget, castSource); + } else { + target.put(key, sourceValue); + } } } } diff --git a/validator/src/main/java/com/google/daq/mqtt/util/JsonUtil.java b/common/src/main/java/com/google/udmi/util/JsonUtil.java similarity index 82% rename from validator/src/main/java/com/google/daq/mqtt/util/JsonUtil.java rename to common/src/main/java/com/google/udmi/util/JsonUtil.java index 71d3ed69c4..b742d7c6cb 100644 --- a/validator/src/main/java/com/google/daq/mqtt/util/JsonUtil.java +++ b/common/src/main/java/com/google/udmi/util/JsonUtil.java @@ -1,4 +1,4 @@ -package com.google.daq.mqtt.util; +package com.google.udmi.util; import static com.google.common.base.Preconditions.checkNotNull; @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import com.google.daq.mqtt.validator.CleanDateFormat; import java.io.File; import java.time.Instant; import java.util.Date; @@ -95,9 +94,10 @@ public static T convertTo(Class targetClass, Object message) { * @param message input object to convert * @return object-as-map */ - @SuppressWarnings("unchecked") public static Map toMap(Object message) { - return convertTo(TreeMap.class, message); + @SuppressWarnings("unchecked") + Map map = convertTo(TreeMap.class, message); + return map; } /** @@ -144,7 +144,37 @@ public static void writeFile(Object target, File file) { } } + /** + * Get a date object parsed from a string representation. + * + * @param timestamp string representation + * @return Date object + */ public static Date getDate(String timestamp) { return timestamp == null ? null : Date.from(Instant.parse(timestamp)); } + + /** + * Convert the json string to a generic map object. + * + * @param input input string + * @return input as map object + */ + public static Map asMap(String input) { + @SuppressWarnings("unchecked") + Map map = convertTo(TreeMap.class, input); + return map; + } + + /** + * Convert the json object to a generic map object. + * + * @param input input object + * @return input as map object + */ + public static Map asMap(Object input) { + @SuppressWarnings("unchecked") + Map map = convertTo(TreeMap.class, input); + return map; + } } diff --git a/common/src/main/java/com/google/udmi/util/SiteModel.java b/common/src/main/java/com/google/udmi/util/SiteModel.java index 8f059914a7..728f535196 100644 --- a/common/src/main/java/com/google/udmi/util/SiteModel.java +++ b/common/src/main/java/com/google/udmi/util/SiteModel.java @@ -17,10 +17,10 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -import udmi.schema.CloudIotConfig; import udmi.schema.CloudModel.Auth_type; import udmi.schema.EndpointConfiguration; import udmi.schema.Envelope; +import udmi.schema.ExecutionConfiguration; import udmi.schema.GatewayModel; import udmi.schema.Metadata; @@ -39,17 +39,17 @@ public class SiteModel { final String sitePath; private Map allMetadata; private Map allDevices; - private CloudIotConfig cloudIotConfig; + private ExecutionConfiguration executionConfiguration; public SiteModel(String sitePath) { this.sitePath = sitePath; } public static EndpointConfiguration makeEndpointConfig(String projectId, - CloudIotConfig cloudIotConfig, String deviceId) { + ExecutionConfiguration executionConfig, String deviceId) { EndpointConfiguration endpoint = new EndpointConfiguration(); endpoint.client_id = getClientId(projectId, - cloudIotConfig.cloud_region, cloudIotConfig.registry_id, deviceId); + executionConfig.cloud_region, executionConfig.registry_id, deviceId); endpoint.hostname = DEFAULT_ENDPOINT_HOSTNAME; return endpoint; } @@ -59,18 +59,18 @@ public static String getClientId(String projectId, String cloudRegion, String re return String.format(ID_FORMAT, projectId, cloudRegion, registryId, deviceId); } - private static CloudIotConfig makeCloudIotConfig(Envelope attributes) { - CloudIotConfig cloudIotConfig = new CloudIotConfig(); - cloudIotConfig.registry_id = Preconditions.checkNotNull(attributes.deviceRegistryId, + private static ExecutionConfiguration makeExecutionConfiguration(Envelope attributes) { + ExecutionConfiguration executionConfiguration = new ExecutionConfiguration(); + executionConfiguration.registry_id = Preconditions.checkNotNull(attributes.deviceRegistryId, "deviceRegistryId"); - cloudIotConfig.cloud_region = Preconditions.checkNotNull(attributes.deviceRegistryLocation, + executionConfiguration.cloud_region = Preconditions.checkNotNull(attributes.deviceRegistryLocation, "deviceRegistryLocation"); - return cloudIotConfig; + return executionConfiguration; } public static EndpointConfiguration makeEndpointConfig(Envelope attributes) { - CloudIotConfig cloudIotConfig = makeCloudIotConfig(attributes); - return makeEndpointConfig(attributes.projectId, cloudIotConfig, attributes.deviceId); + ExecutionConfiguration executionConfiguration = makeExecutionConfiguration(attributes); + return makeEndpointConfig(attributes.projectId, executionConfiguration, attributes.deviceId); } /** @@ -97,7 +97,7 @@ public static ClientInfo parseClientId(String clientId) { } public EndpointConfiguration makeEndpointConfig(String projectId, String deviceId) { - return makeEndpointConfig(projectId, cloudIotConfig, deviceId); + return makeEndpointConfig(projectId, executionConfiguration, deviceId); } private Set getDeviceIds() { @@ -159,7 +159,7 @@ private void loadSiteConfig() { "sitePath not defined in configuration"); File cloudConfig = new File(new File(sitePath), "cloud_iot_config.json"); try { - cloudIotConfig = OBJECT_MAPPER.readValue(cloudConfig, CloudIotConfig.class); + executionConfiguration = OBJECT_MAPPER.readValue(cloudConfig, ExecutionConfiguration.class); } catch (Exception e) { throw new RuntimeException("While reading config file " + cloudConfig.getAbsolutePath(), e); } @@ -197,7 +197,7 @@ private String getDeviceKeyPrefix(String targetId) { * @return site registry */ public String getRegistryId() { - return cloudIotConfig.registry_id; + return executionConfiguration.registry_id; } /** @@ -206,7 +206,7 @@ public String getRegistryId() { * @return update topic */ public String getUpdateTopic() { - return cloudIotConfig.update_topic; + return executionConfiguration.update_topic; } public Device getDevice(String deviceId) { diff --git a/common/src/test/java/com/google/udmi/util/GeneralUtilsTest.java b/common/src/test/java/com/google/udmi/util/GeneralUtilsTest.java new file mode 100644 index 0000000000..70a71c316e --- /dev/null +++ b/common/src/test/java/com/google/udmi/util/GeneralUtilsTest.java @@ -0,0 +1,91 @@ +package com.google.udmi.util; + +import static com.google.udmi.util.GeneralUtils.deepCopy; +import static com.google.udmi.util.GeneralUtils.mergeObject; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; + +import com.google.common.collect.ImmutableMap; +import java.util.HashMap; +import java.util.Map; +import org.junit.Test; + +/** + * Tests for general utilities. + */ +public class GeneralUtilsTest { + + @Test + @SuppressWarnings("unchecked") + public void testDeepCopy() { + Map original = getBaseMap(); + Map copy = deepCopy(original); + assertEquals("copy is equal", original, copy); + ((Map) copy.get("C")).put("F", "H"); + assertNotEquals("copy is not equal", original, copy); + } + + private Map getBaseMap() { + Map original = new HashMap<>(); + original.put("A", "B"); + original.put("C", ImmutableMap.of("D", "E", "F", "G")); + return original; + } + + @Test + @SuppressWarnings("unchecked") + public void testMergeObject() { + final Map target = deepCopy(getBaseMap()); + final Map originalTarget = deepCopy(target); + final Map source = deepCopy(target); + source.put("X", "Y"); + final Map sourceC = (Map) source.get("C"); + sourceC.put("D", "Q"); + sourceC.put("H", "I"); + final Map originalSource = deepCopy(source); + mergeObject(target, source); + assertEquals("unmolested source", originalSource, source); + assertNotEquals("changed target", target, originalTarget); + assertNull("original X", originalTarget.get("X")); + assertEquals("target X", "Y", target.get("X")); + final Map originalC = (Map) originalTarget.get("C"); + assertEquals("original C.D", "E", originalC.get("D")); + assertEquals("original C.F", "G", originalC.get("F")); + assertNull("original C.H", originalC.get("H")); + final Map targetC = (Map) target.get("C"); + assertEquals("target C.D", "Q", targetC.get("D")); + assertEquals("target C.F", "G", targetC.get("F")); + assertEquals("target C.H", "I", targetC.get("H")); + } + + @Test + public void testMergeTyped() { + Container source = new Container(); + Container target = new Container(); + source.anInt = 2; + source.bool = true; + target.string = "hello"; + target.bool = false; + Container merged = mergeObject(target, source); + assertEquals("source a", 2, source.anInt); + assertEquals("target a", 0, target.anInt); + assertEquals("merged a", 2, merged.anInt); + assertNull("source b", source.string); + assertEquals("target b", "hello", target.string); + assertEquals("merged b", "hello", merged.string); + assertEquals("source c", true, source.bool); + assertEquals("target c", false, target.bool); + assertEquals("merged c", true, merged.bool); + } + + /** + * Simple test container class. + */ + public static class Container { + + public int anInt; + public String string; + public Boolean bool; + } +} \ No newline at end of file diff --git a/etc/validator.out b/etc/validator.out index 4ca1d4cc21..43e162a3a5 100644 --- a/etc/validator.out +++ b/etc/validator.out @@ -25,7 +25,7 @@ sites/udmi_site_model/out/devices/AHU-1/event_pointset.out "sub_type" : "event", "status" : { "message" : "While converting to json node: 1 schema violations found", - "detail" : "While converting to json node: 1 schema violations found @Validator.validateMessage(Validator.java:417); 1 schema violations found; object instance has properties which are not allowed by the schema: [\"extraField\"]", + "detail" : "While converting to json node: 1 schema violations found @Validator.validateMessage(redacted); 1 schema violations found; object instance has properties which are not allowed by the schema: [\"extraField\"]", "category" : "validation.error.simple", "timestamp" : "1999-10-20T01:02:03Z", "level" : 500 diff --git a/gencode/docs/cloud_iot_config.html b/gencode/docs/cloud_iot_config.html deleted file mode 100644 index ae0f0be4ff..0000000000 --- a/gencode/docs/cloud_iot_config.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - Cloud Iot Config - -

Cloud Iot Config

- - -
- - Type: object
-

Parameters for configuring a connection to cloud systems

-
No Additional Properties - - - - - - -
-
-
-

- -

-
- -
-
- - Type: string
- - - - - - - -
-
-
-
-
-
-
-

- -

-
- -
-
- - Type: string
- - - - - - - -
-
-
-
-
-
-
-

- -

-
- -
-
- - Type: string
- - - - - - - -
-
-
-
-
-
-
-

- -

-
- -
-
- - Type: string
- - - - - - - -
-
-
-
-
-
-
-

- -

-
- -
-
- - Type: string
- - - - - - - -
-
-
-
- - - \ No newline at end of file diff --git a/gencode/docs/configuration_execution.html b/gencode/docs/configuration_execution.html new file mode 100644 index 0000000000..bd9c123b6c --- /dev/null +++ b/gencode/docs/configuration_execution.html @@ -0,0 +1,531 @@ + + + + + + + + + + + + + + + + Execution Configuration + +

Execution Configuration

+ + +
+ + Type: object
+

Parameters for configuring the execution run of a UDMI tool

+
No Additional Properties + + + + + + +
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+ + + + + + + +
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: boolean
+ + + + + + + +
+
+
+
+ + + \ No newline at end of file diff --git a/gencode/docs/readme.md b/gencode/docs/readme.md index a69eb18abb..6906b4b039 100644 --- a/gencode/docs/readme.md +++ b/gencode/docs/readme.md @@ -14,7 +14,6 @@ * [**state**](state.html) - [State](../../docs/messages/state.md) message, defined by [`state.json`] ## Site Model -* [**cloud_iot_config**](cloud_iot_config.html) - Parameters for configuring a connection to cloud systems * [**metadata**](metadata.html) - [Metadata](../../docs/specs/metadata.md) is a description about the device: a specification about how the device should be configured and expectations about what the device should be doing. Defined by `metadata.json` ## Blobs @@ -24,6 +23,7 @@ * [**command_discovery**](command_discovery.html) - [Discovery command](../../docs/specs/discovery.md) for provisioning * [**command_mapping**](command_mapping.html) - [Mapping command](../../docs/specs/mapping.md) for provisioning * [**config_mapping**](config_mapping.html) - Configuration for [mapping](../../docs/specs/mapping.md) +* [**configuration_execution**](configuration_execution.html) - Parameters for configuring the execution run of a UDMI tool * [**configuration_pubber**](configuration_pubber.html) - Parameters to define a pubber runtime instance * [**event**](event.html) - Container object for all event schemas, not directly used. * [**event_mapping**](event_mapping.html) - [Mapping result](../../docs/specs/mapping.md) with implicit enumeration diff --git a/gencode/java/udmi/schema/CloudIotConfig.java b/gencode/java/udmi/schema/CloudIotConfig.java deleted file mode 100644 index fbafa456ea..0000000000 --- a/gencode/java/udmi/schema/CloudIotConfig.java +++ /dev/null @@ -1,61 +0,0 @@ - -package udmi.schema; - -import javax.annotation.processing.Generated; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - - -/** - * Cloud Iot Config - *

- * Parameters for configuring a connection to cloud systems - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "registry_id", - "cloud_region", - "site_name", - "update_topic", - "reflect_region" -}) -@Generated("jsonschema2pojo") -public class CloudIotConfig { - - @JsonProperty("registry_id") - public String registry_id; - @JsonProperty("cloud_region") - public String cloud_region; - @JsonProperty("site_name") - public String site_name; - @JsonProperty("update_topic") - public String update_topic; - @JsonProperty("reflect_region") - public String reflect_region; - - @Override - public int hashCode() { - int result = 1; - result = ((result* 31)+((this.site_name == null)? 0 :this.site_name.hashCode())); - result = ((result* 31)+((this.cloud_region == null)? 0 :this.cloud_region.hashCode())); - result = ((result* 31)+((this.update_topic == null)? 0 :this.update_topic.hashCode())); - result = ((result* 31)+((this.registry_id == null)? 0 :this.registry_id.hashCode())); - result = ((result* 31)+((this.reflect_region == null)? 0 :this.reflect_region.hashCode())); - return result; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - if ((other instanceof CloudIotConfig) == false) { - return false; - } - CloudIotConfig rhs = ((CloudIotConfig) other); - return ((((((this.site_name == rhs.site_name)||((this.site_name!= null)&&this.site_name.equals(rhs.site_name)))&&((this.cloud_region == rhs.cloud_region)||((this.cloud_region!= null)&&this.cloud_region.equals(rhs.cloud_region))))&&((this.update_topic == rhs.update_topic)||((this.update_topic!= null)&&this.update_topic.equals(rhs.update_topic))))&&((this.registry_id == rhs.registry_id)||((this.registry_id!= null)&&this.registry_id.equals(rhs.registry_id))))&&((this.reflect_region == rhs.reflect_region)||((this.reflect_region!= null)&&this.reflect_region.equals(rhs.reflect_region)))); - } - -} diff --git a/gencode/java/udmi/schema/ExecutionConfiguration.java b/gencode/java/udmi/schema/ExecutionConfiguration.java new file mode 100644 index 0000000000..9f9482799c --- /dev/null +++ b/gencode/java/udmi/schema/ExecutionConfiguration.java @@ -0,0 +1,101 @@ + +package udmi.schema; + +import javax.annotation.processing.Generated; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Execution Configuration + *

+ * Parameters for configuring the execution run of a UDMI tool + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "registry_id", + "cloud_region", + "site_name", + "update_topic", + "reflect_region", + "site_model", + "device_id", + "project_id", + "key_file", + "serial_no", + "log_level", + "udmi_version", + "alt_project", + "alt_registry", + "block_unknown" +}) +@Generated("jsonschema2pojo") +public class ExecutionConfiguration { + + @JsonProperty("registry_id") + public String registry_id; + @JsonProperty("cloud_region") + public String cloud_region; + @JsonProperty("site_name") + public String site_name; + @JsonProperty("update_topic") + public String update_topic; + @JsonProperty("reflect_region") + public String reflect_region; + @JsonProperty("site_model") + public String site_model; + @JsonProperty("device_id") + public String device_id; + @JsonProperty("project_id") + public String project_id; + @JsonProperty("key_file") + public String key_file; + @JsonProperty("serial_no") + public String serial_no; + @JsonProperty("log_level") + public String log_level; + @JsonProperty("udmi_version") + public String udmi_version; + @JsonProperty("alt_project") + public String alt_project; + @JsonProperty("alt_registry") + public String alt_registry; + @JsonProperty("block_unknown") + public Boolean block_unknown; + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.alt_registry == null)? 0 :this.alt_registry.hashCode())); + result = ((result* 31)+((this.block_unknown == null)? 0 :this.block_unknown.hashCode())); + result = ((result* 31)+((this.cloud_region == null)? 0 :this.cloud_region.hashCode())); + result = ((result* 31)+((this.device_id == null)? 0 :this.device_id.hashCode())); + result = ((result* 31)+((this.key_file == null)? 0 :this.key_file.hashCode())); + result = ((result* 31)+((this.udmi_version == null)? 0 :this.udmi_version.hashCode())); + result = ((result* 31)+((this.alt_project == null)? 0 :this.alt_project.hashCode())); + result = ((result* 31)+((this.log_level == null)? 0 :this.log_level.hashCode())); + result = ((result* 31)+((this.site_model == null)? 0 :this.site_model.hashCode())); + result = ((result* 31)+((this.registry_id == null)? 0 :this.registry_id.hashCode())); + result = ((result* 31)+((this.site_name == null)? 0 :this.site_name.hashCode())); + result = ((result* 31)+((this.update_topic == null)? 0 :this.update_topic.hashCode())); + result = ((result* 31)+((this.project_id == null)? 0 :this.project_id.hashCode())); + result = ((result* 31)+((this.serial_no == null)? 0 :this.serial_no.hashCode())); + result = ((result* 31)+((this.reflect_region == null)? 0 :this.reflect_region.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof ExecutionConfiguration) == false) { + return false; + } + ExecutionConfiguration rhs = ((ExecutionConfiguration) other); + return ((((((((((((((((this.alt_registry == rhs.alt_registry)||((this.alt_registry!= null)&&this.alt_registry.equals(rhs.alt_registry)))&&((this.block_unknown == rhs.block_unknown)||((this.block_unknown!= null)&&this.block_unknown.equals(rhs.block_unknown))))&&((this.cloud_region == rhs.cloud_region)||((this.cloud_region!= null)&&this.cloud_region.equals(rhs.cloud_region))))&&((this.device_id == rhs.device_id)||((this.device_id!= null)&&this.device_id.equals(rhs.device_id))))&&((this.key_file == rhs.key_file)||((this.key_file!= null)&&this.key_file.equals(rhs.key_file))))&&((this.udmi_version == rhs.udmi_version)||((this.udmi_version!= null)&&this.udmi_version.equals(rhs.udmi_version))))&&((this.alt_project == rhs.alt_project)||((this.alt_project!= null)&&this.alt_project.equals(rhs.alt_project))))&&((this.log_level == rhs.log_level)||((this.log_level!= null)&&this.log_level.equals(rhs.log_level))))&&((this.site_model == rhs.site_model)||((this.site_model!= null)&&this.site_model.equals(rhs.site_model))))&&((this.registry_id == rhs.registry_id)||((this.registry_id!= null)&&this.registry_id.equals(rhs.registry_id))))&&((this.site_name == rhs.site_name)||((this.site_name!= null)&&this.site_name.equals(rhs.site_name))))&&((this.update_topic == rhs.update_topic)||((this.update_topic!= null)&&this.update_topic.equals(rhs.update_topic))))&&((this.project_id == rhs.project_id)||((this.project_id!= null)&&this.project_id.equals(rhs.project_id))))&&((this.serial_no == rhs.serial_no)||((this.serial_no!= null)&&this.serial_no.equals(rhs.serial_no))))&&((this.reflect_region == rhs.reflect_region)||((this.reflect_region!= null)&&this.reflect_region.equals(rhs.reflect_region)))); + } + +} diff --git a/gencode/python/udmi/schema/__init__.py b/gencode/python/udmi/schema/__init__.py index 5e25d1f284..3df63ea23a 100644 --- a/gencode/python/udmi/schema/__init__.py +++ b/gencode/python/udmi/schema/__init__.py @@ -2,7 +2,6 @@ from .building_config import BuildingConfig from .building_translation import BuildingTranslation from .category import ObjectC50A4669 -from .cloud_iot_config import CloudIotConfig from .command_discovery import DiscoveryCommand from .command_mapping import MappingCommand from .common import Common @@ -20,6 +19,7 @@ from .config_system import SystemConfig from .config_system_testing import TestingSystemConfig from .configuration_endpoint import EndpointConfiguration +from .configuration_execution import ExecutionConfiguration from .configuration_pubber import PubberConfiguration from .envelope import Envelope from .event import Event diff --git a/gencode/python/udmi/schema/cloud_iot_config.py b/gencode/python/udmi/schema/cloud_iot_config.py deleted file mode 100644 index 2bf7b4f51c..0000000000 --- a/gencode/python/udmi/schema/cloud_iot_config.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Generated class for cloud_iot_config.json""" - - -class CloudIotConfig: - """Generated schema class""" - - def __init__(self): - self.registry_id = None - self.cloud_region = None - self.site_name = None - self.update_topic = None - self.reflect_region = None - - @staticmethod - def from_dict(source): - if not source: - return None - result = CloudIotConfig() - result.registry_id = source.get('registry_id') - result.cloud_region = source.get('cloud_region') - result.site_name = source.get('site_name') - result.update_topic = source.get('update_topic') - result.reflect_region = source.get('reflect_region') - return result - - @staticmethod - def map_from(source): - if not source: - return None - result = {} - for key in source: - result[key] = CloudIotConfig.from_dict(source[key]) - return result - - @staticmethod - def expand_dict(input): - result = {} - for property in input: - result[property] = input[property].to_dict() if input[property] else {} - return result - - def to_dict(self): - result = {} - if self.registry_id: - result['registry_id'] = self.registry_id # 5 - if self.cloud_region: - result['cloud_region'] = self.cloud_region # 5 - if self.site_name: - result['site_name'] = self.site_name # 5 - if self.update_topic: - result['update_topic'] = self.update_topic # 5 - if self.reflect_region: - result['reflect_region'] = self.reflect_region # 5 - return result diff --git a/gencode/python/udmi/schema/configuration_execution.py b/gencode/python/udmi/schema/configuration_execution.py new file mode 100644 index 0000000000..b3b97105f7 --- /dev/null +++ b/gencode/python/udmi/schema/configuration_execution.py @@ -0,0 +1,94 @@ +"""Generated class for configuration_execution.json""" + + +class ExecutionConfiguration: + """Generated schema class""" + + def __init__(self): + self.registry_id = None + self.cloud_region = None + self.site_name = None + self.update_topic = None + self.reflect_region = None + self.site_model = None + self.device_id = None + self.project_id = None + self.key_file = None + self.serial_no = None + self.log_level = None + self.udmi_version = None + self.alt_project = None + self.alt_registry = None + self.block_unknown = None + + @staticmethod + def from_dict(source): + if not source: + return None + result = ExecutionConfiguration() + result.registry_id = source.get('registry_id') + result.cloud_region = source.get('cloud_region') + result.site_name = source.get('site_name') + result.update_topic = source.get('update_topic') + result.reflect_region = source.get('reflect_region') + result.site_model = source.get('site_model') + result.device_id = source.get('device_id') + result.project_id = source.get('project_id') + result.key_file = source.get('key_file') + result.serial_no = source.get('serial_no') + result.log_level = source.get('log_level') + result.udmi_version = source.get('udmi_version') + result.alt_project = source.get('alt_project') + result.alt_registry = source.get('alt_registry') + result.block_unknown = source.get('block_unknown') + return result + + @staticmethod + def map_from(source): + if not source: + return None + result = {} + for key in source: + result[key] = ExecutionConfiguration.from_dict(source[key]) + return result + + @staticmethod + def expand_dict(input): + result = {} + for property in input: + result[property] = input[property].to_dict() if input[property] else {} + return result + + def to_dict(self): + result = {} + if self.registry_id: + result['registry_id'] = self.registry_id # 5 + if self.cloud_region: + result['cloud_region'] = self.cloud_region # 5 + if self.site_name: + result['site_name'] = self.site_name # 5 + if self.update_topic: + result['update_topic'] = self.update_topic # 5 + if self.reflect_region: + result['reflect_region'] = self.reflect_region # 5 + if self.site_model: + result['site_model'] = self.site_model # 5 + if self.device_id: + result['device_id'] = self.device_id # 5 + if self.project_id: + result['project_id'] = self.project_id # 5 + if self.key_file: + result['key_file'] = self.key_file # 5 + if self.serial_no: + result['serial_no'] = self.serial_no # 5 + if self.log_level: + result['log_level'] = self.log_level # 5 + if self.udmi_version: + result['udmi_version'] = self.udmi_version # 5 + if self.alt_project: + result['alt_project'] = self.alt_project # 5 + if self.alt_registry: + result['alt_registry'] = self.alt_registry # 5 + if self.block_unknown: + result['block_unknown'] = self.block_unknown # 5 + return result diff --git a/pubber/src/main/java/daq/pubber/Pubber.java b/pubber/src/main/java/daq/pubber/Pubber.java index c42458f05d..4178c370c0 100644 --- a/pubber/src/main/java/daq/pubber/Pubber.java +++ b/pubber/src/main/java/daq/pubber/Pubber.java @@ -937,8 +937,7 @@ private void maybeRedirectEndpoint() { private String redirectedEndpoint(String redirectRegistry) { try { - EndpointConfiguration endpoint = deepCopy(configuration.endpoint, - EndpointConfiguration.class); + EndpointConfiguration endpoint = deepCopy(configuration.endpoint); endpoint.client_id = getClientId(redirectRegistry); return toJsonString(endpoint); } catch (Exception e) { diff --git a/schema/cloud_iot_config.json b/schema/cloud_iot_config.json deleted file mode 100644 index a4028f4daf..0000000000 --- a/schema/cloud_iot_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "title": "Cloud Iot Config", - "description": "Parameters for configuring a connection to cloud systems", - "$section": "Site Model", - "type": "object", - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalProperties": false, - "properties": { - "registry_id": { - "type": "string" - }, - "cloud_region": { - "type": "string" - }, - "site_name": { - "type": "string" - }, - "update_topic": { - "type": "string" - }, - "reflect_region": { - "type": "string" - } - } -} diff --git a/schema/configuration_execution.json b/schema/configuration_execution.json new file mode 100644 index 0000000000..6c92c768c8 --- /dev/null +++ b/schema/configuration_execution.json @@ -0,0 +1,55 @@ +{ + "title": "Execution Configuration", + "description": "Parameters for configuring the execution run of a UDMI tool", + "$section": "Tool Configuration", + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "properties": { + "registry_id": { + "type": "string" + }, + "cloud_region": { + "type": "string" + }, + "site_name": { + "type": "string" + }, + "update_topic": { + "type": "string" + }, + "reflect_region": { + "type": "string" + }, + "site_model": { + "type": "string" + }, + "device_id": { + "type": "string" + }, + "project_id": { + "type": "string" + }, + "key_file": { + "type": "string" + }, + "serial_no": { + "type": "string" + }, + "log_level": { + "type": "string" + }, + "udmi_version": { + "type": "string" + }, + "alt_project": { + "type": "string" + }, + "alt_registry": { + "type": "string" + }, + "block_unknown": { + "type": "boolean" + } + } +} diff --git a/tests/cloud_iot_config.tests/cloud_iot_config.json b/tests/configuration_execution.tests/cloud_iot_config.json similarity index 100% rename from tests/cloud_iot_config.tests/cloud_iot_config.json rename to tests/configuration_execution.tests/cloud_iot_config.json diff --git a/tests/cloud_iot_config.tests/cloud_iot_config.out b/tests/configuration_execution.tests/cloud_iot_config.out similarity index 100% rename from tests/cloud_iot_config.tests/cloud_iot_config.out rename to tests/configuration_execution.tests/cloud_iot_config.out diff --git a/validator/.idea/runConfigurations/Registrar.xml b/validator/.idea/runConfigurations/Registrar.xml index af305a1e0b..6b8b5e0301 100644 --- a/validator/.idea/runConfigurations/Registrar.xml +++ b/validator/.idea/runConfigurations/Registrar.xml @@ -2,11 +2,11 @@