Added tenant profile upgrade script & Added argument test & removed outdated todo items
This commit is contained in:
parent
faf842f998
commit
0c03abe5e6
@ -43,4 +43,23 @@ DROP INDEX IF EXISTS idx_widgets_bundle_external_id;
|
|||||||
|
|
||||||
-- DROP INDEXES THAT DUPLICATE UNIQUE CONSTRAINT END
|
-- DROP INDEXES THAT DUPLICATE UNIQUE CONSTRAINT END
|
||||||
|
|
||||||
ALTER TABLE mobile_app ADD COLUMN IF NOT EXISTS title varchar(255);
|
-- ADD NEW COLUMN TITLE TO MOBILE APP START
|
||||||
|
|
||||||
|
ALTER TABLE mobile_app ADD COLUMN IF NOT EXISTS title varchar(255);
|
||||||
|
|
||||||
|
-- ADD NEW COLUMN TITLE TO MOBILE APP END
|
||||||
|
|
||||||
|
-- UPDATE TENANT PROFILE CONFIGURATION START
|
||||||
|
|
||||||
|
UPDATE tenant_profile
|
||||||
|
SET profile_data = jsonb_set(
|
||||||
|
profile_data,
|
||||||
|
'{configuration}',
|
||||||
|
(profile_data -> 'configuration') || '{
|
||||||
|
"minAllowedScheduledUpdateIntervalInSecForCF": 3600
|
||||||
|
}'::jsonb,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
WHERE (profile_data -> 'configuration' -> 'minAllowedScheduledUpdateIntervalInSecForCF') IS NULL;
|
||||||
|
|
||||||
|
-- UPDATE TENANT PROFILE CONFIGURATION END
|
||||||
|
|||||||
@ -71,8 +71,7 @@ public class GeofencingZoneState {
|
|||||||
this.ts = newZoneState.getTs();
|
this.ts = newZoneState.getTs();
|
||||||
this.version = newVersion;
|
this.version = newVersion;
|
||||||
this.perimeterDefinition = newZoneState.getPerimeterDefinition();
|
this.perimeterDefinition = newZoneState.getPerimeterDefinition();
|
||||||
// TODO: should we reinitialize state if zone changed?
|
this.inside = null;
|
||||||
// this.inside = null;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -160,7 +160,6 @@ public class GeofencingCalculatedFieldStateTest {
|
|||||||
assertThat(state.getArguments()).isEqualTo(newArgs);
|
assertThat(state.getArguments()).isEqualTo(newArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: write opposite test for this. See TODO in the GeofencingZoneState class.
|
|
||||||
@Test
|
@Test
|
||||||
void testUpdateStateWhenUpdateExistingGeofencingValueArgumentEntryWithTheSameValue() {
|
void testUpdateStateWhenUpdateExistingGeofencingValueArgumentEntryWithTheSameValue() {
|
||||||
state.arguments = new HashMap<>(Map.of("allowedZones", geofencingAllowedZoneArgEntry));
|
state.arguments = new HashMap<>(Map.of("allowedZones", geofencingAllowedZoneArgEntry));
|
||||||
@ -345,9 +344,6 @@ public class GeofencingCalculatedFieldStateTest {
|
|||||||
config.setZoneRelationType("CurrentZone");
|
config.setZoneRelationType("CurrentZone");
|
||||||
config.setZoneRelationDirection(EntitySearchDirection.TO);
|
config.setZoneRelationDirection(EntitySearchDirection.TO);
|
||||||
|
|
||||||
// TODO: Does CF possible to save with null?
|
|
||||||
config.setExpression("latitude + longitude");
|
|
||||||
|
|
||||||
Output output = new Output();
|
Output output = new Output();
|
||||||
output.setType(OutputType.TIME_SERIES);
|
output.setType(OutputType.TIME_SERIES);
|
||||||
config.setOutput(output);
|
config.setOutput(output);
|
||||||
|
|||||||
@ -184,6 +184,4 @@ public class GeofencingValueArgumentEntryTest {
|
|||||||
assertThat(geofencingArgumentEntry.isEmpty()).isTrue();
|
assertThat(geofencingArgumentEntry.isEmpty()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should we test to TBEL logic?
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,6 @@ public class Argument {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private EntityId refEntityId;
|
private EntityId refEntityId;
|
||||||
// TODO: add upgrade in PE version -> CFArgumentDynamicSourceType to CFArgumentDynamicSourceConfiguration
|
|
||||||
private CfArgumentDynamicSourceConfiguration refDynamicSourceConfiguration;
|
private CfArgumentDynamicSourceConfiguration refDynamicSourceConfiguration;
|
||||||
private ReferencedEntityKey refEntityKey;
|
private ReferencedEntityKey refEntityKey;
|
||||||
private String defaultValue;
|
private String defaultValue;
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Copyright © 2016-2025 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.server.common.data.cf.configuration;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
public class ArgumentTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void validateShouldReturnFalseIfDynamicSourceConfigurationIsNull() {
|
||||||
|
var argument = new Argument();
|
||||||
|
assertThat(argument.hasDynamicSource()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void validateShouldReturnTrueIfDynamicSourceConfigurationIsNotNull() {
|
||||||
|
var argument = new Argument();
|
||||||
|
argument.setRefDynamicSourceConfiguration(new RelationQueryDynamicSourceConfiguration());
|
||||||
|
assertThat(argument.hasDynamicSource()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user