Browse Source

TbMsgAttributesNode default config setUpdateAttributesOnValueChange(true), rule-chains template version 1

pull/9105/head
Sergey Matvienko 3 years ago
parent
commit
125385b582
  1. 1
      application/src/main/data/json/edge/rule_chains/edge_root_rule_chain.json
  2. 1
      application/src/main/data/json/tenant/device_profile/rule_chain_template.json
  3. 1
      application/src/main/data/json/tenant/rule_chains/root_rule_chain.json
  4. 4
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgAttributesNodeConfiguration.java
  5. 29
      rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/TbMsgAttributesNodeConfigurationTest.java

1
application/src/main/data/json/edge/rule_chains/edge_root_rule_chain.json

@ -49,6 +49,7 @@
"name": "Save Client Attributes",
"debugMode": false,
"configuration": {
"version": 1,
"scope": "CLIENT_SCOPE",
"notifyDevice": "false",
"sendAttributesUpdatedNotification": "false",

1
application/src/main/data/json/tenant/device_profile/rule_chain_template.json

@ -33,6 +33,7 @@
"name": "Save Client Attributes",
"debugMode": false,
"configuration": {
"version": 1,
"scope": "CLIENT_SCOPE",
"notifyDevice": "false",
"sendAttributesUpdatedNotification": "false",

1
application/src/main/data/json/tenant/rule_chains/root_rule_chain.json

@ -32,6 +32,7 @@
"name": "Save Client Attributes",
"debugMode": false,
"configuration": {
"version": 1,
"scope": "CLIENT_SCOPE",
"notifyDevice": "false",
"sendAttributesUpdatedNotification": "false",

4
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgAttributesNodeConfiguration.java

@ -34,8 +34,8 @@ public class TbMsgAttributesNodeConfiguration implements NodeConfiguration<TbMsg
configuration.setScope(DataConstants.SERVER_SCOPE);
configuration.setNotifyDevice(false);
configuration.setSendAttributesUpdatedNotification(false);
// backward compatibility for existing tenants, but rule chain templates will have the true value for new tenants
configuration.setUpdateAttributesOnValueChange(false);
//Since version 1. For an existing rule nodes for version 0. See the TbVersionedNode implementation
configuration.setUpdateAttributesOnValueChange(true);
return configuration;
}
}

29
rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/TbMsgAttributesNodeConfigurationTest.java

@ -0,0 +1,29 @@
/**
* Copyright © 2016-2023 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.rule.engine.telemetry;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class TbMsgAttributesNodeConfigurationTest {
@Test
void testDefaultConfig_givenUpdateAttributesOnValueChange_thenTrue_sinceVersion1() {
assertThat(new TbMsgAttributesNodeConfiguration().defaultConfiguration().isUpdateAttributesOnValueChange()).isTrue();
}
}
Loading…
Cancel
Save