fixed license, included edqs tests to test suite
This commit is contained in:
		
							parent
							
								
									f1e42aeeb0
								
							
						
					
					
						commit
						6c8887995a
					
				@ -1,5 +1,5 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# Copyright © 2016-2024 The Thingsboard Authors
 | 
					# Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					# Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					# you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# Copyright © 2016-2024 The Thingsboard Authors
 | 
					# Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					# Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					# you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" ?>
 | 
					<?xml version="1.0" encoding="UTF-8" ?>
 | 
				
			||||||
<!--
 | 
					<!--
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Copyright © 2016-2024 The Thingsboard Authors
 | 
					    Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Licensed under the Apache License, Version 2.0 (the "License");
 | 
					    Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
    you may not use this file except in compliance with the License.
 | 
					    you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
@ -165,7 +165,8 @@ public class ContainerTestSuite {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // to trigger edqs synchronization
 | 
					            // to trigger edqs synchronization
 | 
				
			||||||
            addToFile(targetDir, "tb-node.env",
 | 
					            addToFile(targetDir, "tb-node.env",
 | 
				
			||||||
                    Map.of("TB_EDQS_SYNC_ENABLED", "true"));
 | 
					                    Map.of("TB_EDQS_SYNC_ENABLED", "true",
 | 
				
			||||||
 | 
					                            "TB_EDQS_API_ENABLED", "true"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            testContainer = new DockerComposeContainerImpl<>(composeFiles)
 | 
					            testContainer = new DockerComposeContainerImpl<>(composeFiles)
 | 
				
			||||||
                    .withPull(false)
 | 
					                    .withPull(false)
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,6 @@ import io.restassured.internal.ValidatableResponseImpl;
 | 
				
			|||||||
import io.restassured.path.json.JsonPath;
 | 
					import io.restassured.path.json.JsonPath;
 | 
				
			||||||
import io.restassured.response.ValidatableResponse;
 | 
					import io.restassured.response.ValidatableResponse;
 | 
				
			||||||
import io.restassured.specification.RequestSpecification;
 | 
					import io.restassured.specification.RequestSpecification;
 | 
				
			||||||
import org.thingsboard.common.util.JacksonUtil;
 | 
					 | 
				
			||||||
import org.thingsboard.server.common.data.Customer;
 | 
					import org.thingsboard.server.common.data.Customer;
 | 
				
			||||||
import org.thingsboard.server.common.data.Dashboard;
 | 
					import org.thingsboard.server.common.data.Dashboard;
 | 
				
			||||||
import org.thingsboard.server.common.data.Device;
 | 
					import org.thingsboard.server.common.data.Device;
 | 
				
			||||||
@ -114,6 +113,11 @@ public class TestRestClient {
 | 
				
			|||||||
        requestSpec.header(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
 | 
					        requestSpec.header(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void resetToken() {
 | 
				
			||||||
 | 
					        token = null;
 | 
				
			||||||
 | 
					        refreshToken = null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Tenant postTenant(Tenant tenant) {
 | 
					    public Tenant postTenant(Tenant tenant) {
 | 
				
			||||||
        return given().spec(requestSpec).body(tenant)
 | 
					        return given().spec(requestSpec).body(tenant)
 | 
				
			||||||
                .post("/api/tenant")
 | 
					                .post("/api/tenant")
 | 
				
			||||||
@ -494,11 +498,11 @@ public class TestRestClient {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public UserId createUserAndLogin(User user, String password) {
 | 
					    public UserId createUserAndLogin(User user, String password) {
 | 
				
			||||||
        UserId userId = postUser(user).getId();
 | 
					        UserId userId = postUser(user).getId();
 | 
				
			||||||
        getUserToken(userId.getId().toString());
 | 
					        getAndSetUserToken(userId.getId().toString());
 | 
				
			||||||
        return userId;
 | 
					        return userId;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void getUserToken(String id) {
 | 
					    public void getAndSetUserToken(String id) {
 | 
				
			||||||
        ObjectNode tokenInfo = given().spec(requestSpec)
 | 
					        ObjectNode tokenInfo = given().spec(requestSpec)
 | 
				
			||||||
                .get("/api/user/" + id + "/token")
 | 
					                .get("/api/user/" + id + "/token")
 | 
				
			||||||
                .then()
 | 
					                .then()
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
/**
 | 
					/**
 | 
				
			||||||
 * Copyright © 2016-2024 The Thingsboard Authors
 | 
					 * Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
@ -53,6 +53,7 @@ import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultCustom
 | 
				
			|||||||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
 | 
					import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultDeviceProfile;
 | 
				
			||||||
import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultTenantAdmin;
 | 
					import static org.thingsboard.server.msa.ui.utils.EntityPrototypes.defaultTenantAdmin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@DisableUIListeners
 | 
				
			||||||
public class EdqsEntityDataQueryTest extends AbstractContainerTest {
 | 
					public class EdqsEntityDataQueryTest extends AbstractContainerTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private TenantId tenantId;
 | 
					    private TenantId tenantId;
 | 
				
			||||||
@ -70,7 +71,7 @@ public class EdqsEntityDataQueryTest extends AbstractContainerTest {
 | 
				
			|||||||
    @BeforeClass
 | 
					    @BeforeClass
 | 
				
			||||||
    public void beforeClass() throws Exception {
 | 
					    public void beforeClass() throws Exception {
 | 
				
			||||||
        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
					        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
				
			||||||
        await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> testRestClient.isEdqsApiEnabled());
 | 
					        await().atMost(60, TimeUnit.SECONDS).until(() -> testRestClient.isEdqsApiEnabled());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tenantId = testRestClient.postTenant(EntityPrototypes.defaultTenantPrototype("Tenant")).getId();
 | 
					        tenantId = testRestClient.postTenant(EntityPrototypes.defaultTenantPrototype("Tenant")).getId();
 | 
				
			||||||
        tenantAdminId = testRestClient.createUserAndLogin(defaultTenantAdmin(tenantId, "tenantAdmin@thingsboard.org"), "tenant");
 | 
					        tenantAdminId = testRestClient.createUserAndLogin(defaultTenantAdmin(tenantId, "tenantAdmin@thingsboard.org"), "tenant");
 | 
				
			||||||
@ -97,6 +98,7 @@ public class EdqsEntityDataQueryTest extends AbstractContainerTest {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @AfterClass
 | 
					    @AfterClass
 | 
				
			||||||
    public void afterClass() {
 | 
					    public void afterClass() {
 | 
				
			||||||
 | 
					        testRestClient.resetToken();
 | 
				
			||||||
        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
					        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
				
			||||||
        testRestClient.deleteTenant(tenantId);
 | 
					        testRestClient.deleteTenant(tenantId);
 | 
				
			||||||
        testRestClient.deleteTenant(tenantId2);
 | 
					        testRestClient.deleteTenant(tenantId2);
 | 
				
			||||||
@ -111,13 +113,14 @@ public class EdqsEntityDataQueryTest extends AbstractContainerTest {
 | 
				
			|||||||
                .atMost(30, TimeUnit.SECONDS)
 | 
					                .atMost(30, TimeUnit.SECONDS)
 | 
				
			||||||
                .until(() -> testRestClient.postCountDataQuery(query).compareTo(97L * 2) >= 0);
 | 
					                .until(() -> testRestClient.postCountDataQuery(query).compareTo(97L * 2) >= 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        testRestClient.getUserToken(tenantAdminId.getId().toString());
 | 
					        testRestClient.getAndSetUserToken(tenantAdminId.getId().toString());
 | 
				
			||||||
        await("Waiting for total device count")
 | 
					        await("Waiting for total device count")
 | 
				
			||||||
                .atMost(30, TimeUnit.SECONDS)
 | 
					                .atMost(30, TimeUnit.SECONDS)
 | 
				
			||||||
                .until(() -> testRestClient.postCountDataQuery(query).equals(97L));
 | 
					                .until(() -> testRestClient.postCountDataQuery(query).equals(97L));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        testRestClient.resetToken();
 | 
				
			||||||
        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
					        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
				
			||||||
        testRestClient.getUserToken(tenant2AdminId.getId().toString());
 | 
					        testRestClient.getAndSetUserToken(tenant2AdminId.getId().toString());
 | 
				
			||||||
        await("Waiting for total device count")
 | 
					        await("Waiting for total device count")
 | 
				
			||||||
                .atMost(30, TimeUnit.SECONDS)
 | 
					                .atMost(30, TimeUnit.SECONDS)
 | 
				
			||||||
                .until(() -> testRestClient.postCountDataQuery(query).equals(97L));
 | 
					                .until(() -> testRestClient.postCountDataQuery(query).equals(97L));
 | 
				
			||||||
@ -126,16 +129,17 @@ public class EdqsEntityDataQueryTest extends AbstractContainerTest {
 | 
				
			|||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public void testRetrieveTenantDevicesByDeviceTypeFilter() {
 | 
					    public void testRetrieveTenantDevicesByDeviceTypeFilter() {
 | 
				
			||||||
        // login tenant admin
 | 
					        // login tenant admin
 | 
				
			||||||
        testRestClient.getUserToken(tenantAdminId.getId().toString());
 | 
					        testRestClient.getAndSetUserToken(tenantAdminId.getId().toString());
 | 
				
			||||||
        checkUserDevices(tenantDevices);
 | 
					        checkUserDevices(tenantDevices);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // login customer user
 | 
					        // login customer user
 | 
				
			||||||
        testRestClient.getUserToken(customerUserId.getId().toString());
 | 
					        testRestClient.getAndSetUserToken(customerUserId.getId().toString());
 | 
				
			||||||
        checkUserDevices(tenantDevices.subList(0, 12));
 | 
					        checkUserDevices(tenantDevices.subList(0, 12));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // login other tenant admin
 | 
					        // login other tenant admin
 | 
				
			||||||
 | 
					        testRestClient.resetToken();
 | 
				
			||||||
        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
					        testRestClient.login("sysadmin@thingsboard.org", "sysadmin");
 | 
				
			||||||
        testRestClient.getUserToken(tenant2AdminId.getId().toString());
 | 
					        testRestClient.getAndSetUserToken(tenant2AdminId.getId().toString());
 | 
				
			||||||
        checkUserDevices(tenant2Devices);
 | 
					        checkUserDevices(tenant2Devices);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -87,4 +87,14 @@
 | 
				
			|||||||
            <package name="org.thingsboard.server.msa.ui.tests.alarmassignee.*"/>
 | 
					            <package name="org.thingsboard.server.msa.ui.tests.alarmassignee.*"/>
 | 
				
			||||||
        </packages>
 | 
					        </packages>
 | 
				
			||||||
    </test>
 | 
					    </test>
 | 
				
			||||||
 | 
					    <test name="Edqs tests">
 | 
				
			||||||
 | 
					        <groups>
 | 
				
			||||||
 | 
					            <run>
 | 
				
			||||||
 | 
					                <exclude name="broken"/>
 | 
				
			||||||
 | 
					            </run>
 | 
				
			||||||
 | 
					        </groups>
 | 
				
			||||||
 | 
					        <packages>
 | 
				
			||||||
 | 
					            <package name="org.thingsboard.server.msa.edqs.*"/>
 | 
				
			||||||
 | 
					        </packages>
 | 
				
			||||||
 | 
					    </test>
 | 
				
			||||||
</suite>
 | 
					</suite>
 | 
				
			||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# Copyright © 2016-2024 The Thingsboard Authors
 | 
					# Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					# Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					# you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright © 2016-2024 The Thingsboard Authors
 | 
					# Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
					# Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
# you may not use this file except in compliance with the License.
 | 
					# you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
<!--
 | 
					<!--
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Copyright © 2016-2024 The Thingsboard Authors
 | 
					    Copyright © 2016-2025 The Thingsboard Authors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Licensed under the Apache License, Version 2.0 (the "License");
 | 
					    Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
    you may not use this file except in compliance with the License.
 | 
					    you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user