Merge branch 'rc'
This commit is contained in:
		
						commit
						97978c7461
					
				@ -101,6 +101,11 @@ public class SingleValueArgumentEntry implements ArgumentEntry {
 | 
				
			|||||||
            } catch (Exception e) {
 | 
					            } catch (Exception e) {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (value instanceof Long longValue) {
 | 
				
			||||||
 | 
					            if (longValue >= Integer.MIN_VALUE && longValue <= Integer.MAX_VALUE) {
 | 
				
			||||||
 | 
					                value = longValue.intValue();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return new TbelCfSingleValueArg(ts, value);
 | 
					        return new TbelCfSingleValueArg(ts, value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ import org.junit.jupiter.api.BeforeEach;
 | 
				
			|||||||
import org.junit.jupiter.api.Test;
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.boot.test.context.SpringBootTest;
 | 
					import org.springframework.boot.test.context.SpringBootTest;
 | 
				
			||||||
import org.springframework.boot.test.mock.mockito.MockBean;
 | 
					import org.springframework.test.context.bean.override.mockito.MockitoBean;
 | 
				
			||||||
import org.thingsboard.common.util.JacksonUtil;
 | 
					import org.thingsboard.common.util.JacksonUtil;
 | 
				
			||||||
import org.thingsboard.script.api.tbel.DefaultTbelInvokeService;
 | 
					import org.thingsboard.script.api.tbel.DefaultTbelInvokeService;
 | 
				
			||||||
import org.thingsboard.script.api.tbel.TbelInvokeService;
 | 
					import org.thingsboard.script.api.tbel.TbelInvokeService;
 | 
				
			||||||
@ -60,7 +60,7 @@ public class ScriptCalculatedFieldStateTest {
 | 
				
			|||||||
    private final DeviceId DEVICE_ID = new DeviceId(UUID.fromString("5512071d-5abc-411d-a907-4cdb6539c2eb"));
 | 
					    private final DeviceId DEVICE_ID = new DeviceId(UUID.fromString("5512071d-5abc-411d-a907-4cdb6539c2eb"));
 | 
				
			||||||
    private final AssetId ASSET_ID = new AssetId(UUID.fromString("5bc010ae-bcfd-46c8-98b9-8ee8c8955a76"));
 | 
					    private final AssetId ASSET_ID = new AssetId(UUID.fromString("5bc010ae-bcfd-46c8-98b9-8ee8c8955a76"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final SingleValueArgumentEntry assetHumidityArgEntry = new SingleValueArgumentEntry(System.currentTimeMillis() - 10, new DoubleDataEntry("assetHumidity", 43.0), 122L);
 | 
					    private final SingleValueArgumentEntry assetHumidityArgEntry = new SingleValueArgumentEntry(System.currentTimeMillis() - 10, new DoubleDataEntry("assetHumidity", 86.0), 122L);
 | 
				
			||||||
    private final TsRollingArgumentEntry deviceTemperatureArgEntry = createRollingArgEntry();
 | 
					    private final TsRollingArgumentEntry deviceTemperatureArgEntry = createRollingArgEntry();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final long ts = System.currentTimeMillis();
 | 
					    private final long ts = System.currentTimeMillis();
 | 
				
			||||||
@ -71,7 +71,7 @@ public class ScriptCalculatedFieldStateTest {
 | 
				
			|||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private TbelInvokeService tbelInvokeService;
 | 
					    private TbelInvokeService tbelInvokeService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @MockBean
 | 
					    @MockitoBean
 | 
				
			||||||
    private ApiLimitService apiLimitService;
 | 
					    private ApiLimitService apiLimitService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @BeforeEach
 | 
					    @BeforeEach
 | 
				
			||||||
@ -133,6 +133,22 @@ public class ScriptCalculatedFieldStateTest {
 | 
				
			|||||||
        assertThat(result.getResult()).isEqualTo(JacksonUtil.valueToTree(Map.of("maxDeviceTemperature", 17.0, "assetHumidity", 43.0)));
 | 
					        assertThat(result.getResult()).isEqualTo(JacksonUtil.valueToTree(Map.of("maxDeviceTemperature", 17.0, "assetHumidity", 43.0)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    void testPerformCalculationWithLongEntry() throws ExecutionException, InterruptedException {
 | 
				
			||||||
 | 
					        state.arguments = new HashMap<>(Map.of(
 | 
				
			||||||
 | 
					                "deviceTemperature", deviceTemperatureArgEntry,
 | 
				
			||||||
 | 
					                "assetHumidity", new SingleValueArgumentEntry(System.currentTimeMillis() - 10, new LongDataEntry("a", 45L), 10L)
 | 
				
			||||||
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        CalculatedFieldResult result = state.performCalculation(ctx).get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(result).isNotNull();
 | 
				
			||||||
 | 
					        Output output = getCalculatedFieldConfig().getOutput();
 | 
				
			||||||
 | 
					        assertThat(result.getType()).isEqualTo(output.getType());
 | 
				
			||||||
 | 
					        assertThat(result.getScope()).isEqualTo(output.getScope());
 | 
				
			||||||
 | 
					        assertThat(result.getResult()).isEqualTo(JacksonUtil.valueToTree(Map.of("maxDeviceTemperature", 17.0, "assetHumidity", 22.5)));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    void testIsReadyWhenNotAllArgPresent() {
 | 
					    void testIsReadyWhenNotAllArgPresent() {
 | 
				
			||||||
        assertThat(state.isReady()).isFalse();
 | 
					        assertThat(state.isReady()).isFalse();
 | 
				
			||||||
@ -193,7 +209,7 @@ public class ScriptCalculatedFieldStateTest {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        config.setArguments(Map.of("deviceTemperature", argument1, "assetHumidity", argument2));
 | 
					        config.setArguments(Map.of("deviceTemperature", argument1, "assetHumidity", argument2));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        config.setExpression("return {\"maxDeviceTemperature\": deviceTemperature.max(), \"assetHumidity\": assetHumidity}");
 | 
					        config.setExpression("return {\"maxDeviceTemperature\": deviceTemperature.max(), \"assetHumidity\": assetHumidity / 2 }");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Output output = new Output();
 | 
					        Output output = new Output();
 | 
				
			||||||
        output.setType(OutputType.ATTRIBUTES);
 | 
					        output.setType(OutputType.ATTRIBUTES);
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,7 @@
 | 
				
			|||||||
            @if (providerFieldsList.includes('personalAccessToken')) {
 | 
					            @if (providerFieldsList.includes('personalAccessToken')) {
 | 
				
			||||||
              <mat-form-field class="mat-block flex-1" appearance="outline">
 | 
					              <mat-form-field class="mat-block flex-1" appearance="outline">
 | 
				
			||||||
                <mat-label translate>ai-models.personal-access-token</mat-label>
 | 
					                <mat-label translate>ai-models.personal-access-token</mat-label>
 | 
				
			||||||
                <input type="password" required matInput formControlName="personalAccessToken">
 | 
					                <input type="password" required matInput formControlName="personalAccessToken" autocomplete="new-password">
 | 
				
			||||||
                <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					                <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
                <mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('personalAccessToken').hasError('required')">
 | 
					                <mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('personalAccessToken').hasError('required')">
 | 
				
			||||||
                  {{ 'ai-models.personal-access-token-required' | translate }}
 | 
					                  {{ 'ai-models.personal-access-token-required' | translate }}
 | 
				
			||||||
@ -115,7 +115,7 @@
 | 
				
			|||||||
            @if (providerFieldsList.includes('apiKey')) {
 | 
					            @if (providerFieldsList.includes('apiKey')) {
 | 
				
			||||||
              <mat-form-field class="mat-block flex-1" appearance="outline">
 | 
					              <mat-form-field class="mat-block flex-1" appearance="outline">
 | 
				
			||||||
                <mat-label translate>ai-models.api-key</mat-label>
 | 
					                <mat-label translate>ai-models.api-key</mat-label>
 | 
				
			||||||
                <input type="password" required matInput formControlName="apiKey">
 | 
					                <input type="password" required matInput formControlName="apiKey" autocomplete="new-password">
 | 
				
			||||||
                <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					                <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
                <mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('apiKey').hasError('required')">
 | 
					                <mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('apiKey').hasError('required')">
 | 
				
			||||||
                  {{ 'ai-models.api-key-required' | translate }}
 | 
					                  {{ 'ai-models.api-key-required' | translate }}
 | 
				
			||||||
@ -143,7 +143,7 @@
 | 
				
			|||||||
            @if (providerFieldsList.includes('secretAccessKey')) {
 | 
					            @if (providerFieldsList.includes('secretAccessKey')) {
 | 
				
			||||||
              <mat-form-field class="mat-block flex-1" appearance="outline">
 | 
					              <mat-form-field class="mat-block flex-1" appearance="outline">
 | 
				
			||||||
                <mat-label translate>ai-models.secret-access-key</mat-label>
 | 
					                <mat-label translate>ai-models.secret-access-key</mat-label>
 | 
				
			||||||
                <input type="password" required matInput formControlName="secretAccessKey">
 | 
					                <input type="password" required matInput formControlName="secretAccessKey" autocomplete="new-password">
 | 
				
			||||||
                <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					                <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
                <mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('secretAccessKey').hasError('required')">
 | 
					                <mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('secretAccessKey').hasError('required')">
 | 
				
			||||||
                  {{ 'ai-models.secret-access-key-required' | translate }}
 | 
					                  {{ 'ai-models.secret-access-key-required' | translate }}
 | 
				
			||||||
 | 
				
			|||||||
@ -49,7 +49,7 @@
 | 
				
			|||||||
          </mat-form-field>
 | 
					          </mat-form-field>
 | 
				
			||||||
          <mat-form-field class="mat-block">
 | 
					          <mat-form-field class="mat-block">
 | 
				
			||||||
            <mat-label translate>rule-node-config.password</mat-label>
 | 
					            <mat-label translate>rule-node-config.password</mat-label>
 | 
				
			||||||
            <input type="password" [required]="passwordFieldRequired" matInput formControlName="password">
 | 
					            <input type="password" [required]="passwordFieldRequired" matInput formControlName="password" autocomplete="new-password">
 | 
				
			||||||
            <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					            <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
            <mat-error *ngIf="credentialsConfigFormGroup.get('password').hasError('required')">
 | 
					            <mat-error *ngIf="credentialsConfigFormGroup.get('password').hasError('required')">
 | 
				
			||||||
              {{ 'rule-node-config.password-required' | translate }}
 | 
					              {{ 'rule-node-config.password-required' | translate }}
 | 
				
			||||||
@ -85,7 +85,7 @@
 | 
				
			|||||||
          </tb-file-input>
 | 
					          </tb-file-input>
 | 
				
			||||||
          <mat-form-field class="mat-block">
 | 
					          <mat-form-field class="mat-block">
 | 
				
			||||||
            <mat-label translate>rule-node-config.private-key-password</mat-label>
 | 
					            <mat-label translate>rule-node-config.private-key-password</mat-label>
 | 
				
			||||||
            <input type="password" matInput formControlName="password">
 | 
					            <input type="password" matInput formControlName="password" autocomplete="new-password">
 | 
				
			||||||
            <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					            <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
          </mat-form-field>
 | 
					          </mat-form-field>
 | 
				
			||||||
        </ng-template>
 | 
					        </ng-template>
 | 
				
			||||||
 | 
				
			|||||||
@ -64,7 +64,7 @@
 | 
				
			|||||||
  </mat-form-field>
 | 
					  </mat-form-field>
 | 
				
			||||||
  <mat-form-field class="mat-block">
 | 
					  <mat-form-field class="mat-block">
 | 
				
			||||||
    <mat-label translate>rule-node-config.password</mat-label>
 | 
					    <mat-label translate>rule-node-config.password</mat-label>
 | 
				
			||||||
    <input type="password" matInput formControlName="password">
 | 
					    <input type="password" matInput formControlName="password" autocomplete="new-password">
 | 
				
			||||||
    <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					    <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
  </mat-form-field>
 | 
					  </mat-form-field>
 | 
				
			||||||
  <mat-checkbox formControlName="automaticRecoveryEnabled">
 | 
					  <mat-checkbox formControlName="automaticRecoveryEnabled">
 | 
				
			||||||
 | 
				
			|||||||
@ -109,7 +109,7 @@
 | 
				
			|||||||
    </mat-form-field>
 | 
					    </mat-form-field>
 | 
				
			||||||
    <mat-form-field class="mat-block" floatLabel="always">
 | 
					    <mat-form-field class="mat-block" floatLabel="always">
 | 
				
			||||||
      <mat-label translate>rule-node-config.password</mat-label>
 | 
					      <mat-label translate>rule-node-config.password</mat-label>
 | 
				
			||||||
      <input matInput type="password" placeholder="{{ 'rule-node-config.enter-password' | translate }}" formControlName="password">
 | 
					      <input matInput type="password" placeholder="{{ 'rule-node-config.enter-password' | translate }}" formControlName="password" autocomplete="new-password">
 | 
				
			||||||
      <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					      <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
    </mat-form-field>
 | 
					    </mat-form-field>
 | 
				
			||||||
  </section>
 | 
					  </section>
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@
 | 
				
			|||||||
  </mat-form-field>
 | 
					  </mat-form-field>
 | 
				
			||||||
  <mat-form-field class="mat-block">
 | 
					  <mat-form-field class="mat-block">
 | 
				
			||||||
    <mat-label translate>admin.aws-secret-access-key</mat-label>
 | 
					    <mat-label translate>admin.aws-secret-access-key</mat-label>
 | 
				
			||||||
    <input required type="password" matInput formControlName="secretAccessKey">
 | 
					    <input required type="password" matInput formControlName="secretAccessKey" autocomplete="new-password">
 | 
				
			||||||
    <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					    <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
    <mat-error *ngIf="awsSnsProviderConfigurationFormGroup.get('secretAccessKey').hasError('required')">
 | 
					    <mat-error *ngIf="awsSnsProviderConfigurationFormGroup.get('secretAccessKey').hasError('required')">
 | 
				
			||||||
      {{ 'admin.aws-secret-access-key-required' | translate }}
 | 
					      {{ 'admin.aws-secret-access-key-required' | translate }}
 | 
				
			||||||
 | 
				
			|||||||
@ -136,7 +136,7 @@
 | 
				
			|||||||
                  </mat-form-field>
 | 
					                  </mat-form-field>
 | 
				
			||||||
                  <mat-form-field class="mat-block flex-1">
 | 
					                  <mat-form-field class="mat-block flex-1">
 | 
				
			||||||
                    <mat-label translate>admin.proxy-password</mat-label>
 | 
					                    <mat-label translate>admin.proxy-password</mat-label>
 | 
				
			||||||
                    <input matInput type="password" formControlName="proxyPassword" autocomplete="new-proxy-password">
 | 
					                    <input matInput type="password" formControlName="proxyPassword" autocomplete="new-password">
 | 
				
			||||||
                    <tb-toggle-password matSuffix></tb-toggle-password>
 | 
					                    <tb-toggle-password matSuffix></tb-toggle-password>
 | 
				
			||||||
                  </mat-form-field>
 | 
					                  </mat-form-field>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -5276,7 +5276,7 @@
 | 
				
			|||||||
    "add-originator-attributes-to": "Tilføj afsenders attributter til",
 | 
					    "add-originator-attributes-to": "Tilføj afsenders attributter til",
 | 
				
			||||||
    "originator-attributes": "Afsenders attributter",
 | 
					    "originator-attributes": "Afsenders attributter",
 | 
				
			||||||
    "fetch-latest-telemetry-with-timestamp": "Hent seneste telemetry med tidsstempel",
 | 
					    "fetch-latest-telemetry-with-timestamp": "Hent seneste telemetry med tidsstempel",
 | 
				
			||||||
    "fetch-latest-telemetry-with-timestamp-tooltip": "Inkluderer tidsstempel i metadata, f.eks.: \"{{latestTsKeyName}}\": \"{ts:1574329385897, value:42}\"",
 | 
					    "fetch-latest-telemetry-with-timestamp-tooltip": "Inkluderer tidsstempel i metadata, f.eks.: \"{{latestTsKeyName}}\": \"{\"ts\":1574329385897, \"value\":42}\"",
 | 
				
			||||||
    "tell-failure": "Rapportér fejl hvis attribut mangler",
 | 
					    "tell-failure": "Rapportér fejl hvis attribut mangler",
 | 
				
			||||||
    "tell-failure-tooltip": "Rapporterer fejl hvis mindst én valgt nøgle mangler.",
 | 
					    "tell-failure-tooltip": "Rapporterer fejl hvis mindst én valgt nøgle mangler.",
 | 
				
			||||||
    "created-time": "Oprettelsestid",
 | 
					    "created-time": "Oprettelsestid",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user