Commit adb9a8d1501bf37e3ba918ef2b8a5617508555cd

Authored by Sergey Matvienko
1 parent 1adaef31

dao tests: PostgreSqlDaoServiceTestSuite added using org.testcontainers

... ... @@ -202,6 +202,11 @@
202 202 <artifactId>spring-boot-starter-data-jpa</artifactId>
203 203 </dependency>
204 204 <dependency>
  205 + <groupId>org.springframework.boot</groupId>
  206 + <artifactId>spring-boot-starter-test</artifactId>
  207 + <scope>test</scope>
  208 + </dependency>
  209 + <dependency>
205 210 <groupId>org.springframework</groupId>
206 211 <artifactId>spring-test</artifactId>
207 212 <scope>test</scope>
... ... @@ -212,6 +217,16 @@
212 217 <scope>test</scope>
213 218 </dependency>
214 219 <dependency>
  220 + <groupId>org.testcontainers</groupId>
  221 + <artifactId>postgresql</artifactId>
  222 + <scope>test</scope>
  223 + </dependency>
  224 + <dependency>
  225 + <groupId>org.testcontainers</groupId>
  226 + <artifactId>jdbc</artifactId>
  227 + <scope>test</scope>
  228 + </dependency>
  229 + <dependency>
215 230 <groupId>org.springframework</groupId>
216 231 <artifactId>spring-context-support</artifactId>
217 232 </dependency>
... ...
  1 +/**
  2 + * ThingsBoard, Inc. ("COMPANY") CONFIDENTIAL
  3 + *
  4 + * Copyright © 2016-2021 ThingsBoard, Inc. All Rights Reserved.
  5 + *
  6 + * NOTICE: All information contained herein is, and remains
  7 + * the property of ThingsBoard, Inc. and its suppliers,
  8 + * if any. The intellectual and technical concepts contained
  9 + * herein are proprietary to ThingsBoard, Inc.
  10 + * and its suppliers and may be covered by U.S. and Foreign Patents,
  11 + * patents in process, and are protected by trade secret or copyright law.
  12 + *
  13 + * Dissemination of this information or reproduction of this material is strictly forbidden
  14 + * unless prior written permission is obtained from COMPANY.
  15 + *
  16 + * Access to the source code contained herein is hereby forbidden to anyone except current COMPANY employees,
  17 + * managers or contractors who have executed Confidentiality and Non-disclosure agreements
  18 + * explicitly covering such access.
  19 + *
  20 + * The copyright notice above does not evidence any actual or intended publication
  21 + * or disclosure of this source code, which includes
  22 + * information that is confidential and/or proprietary, and is a trade secret, of COMPANY.
  23 + * ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
  24 + * OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT
  25 + * THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED,
  26 + * AND IN VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES.
  27 + * THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION
  28 + * DOES NOT CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS,
  29 + * OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
  30 + */
  31 +package org.thingsboard.server.dao;
  32 +
  33 +import org.junit.ClassRule;
  34 +import org.junit.extensions.cpsuite.ClasspathSuite;
  35 +import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters;
  36 +import org.junit.runner.RunWith;
  37 +
  38 +import java.util.Arrays;
  39 +
  40 +@RunWith(ClasspathSuite.class)
  41 +@ClassnameFilters({
  42 + "org.thingsboard.server.dao.service.psql.*SqlTest",
  43 + "org.thingsboard.server.dao.service.attributes.psql.*SqlTest",
  44 + "org.thingsboard.server.dao.service.event.psql.*SqlTest",
  45 + "org.thingsboard.server.dao.service.timeseries.psql.*SqlTest"
  46 +})
  47 +public class PostgreSqlDaoServiceTestSuite {
  48 +
  49 + @ClassRule
  50 + public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
  51 + Arrays.asList("sql/schema-ts-psql.sql", "sql/schema-entities.sql", "sql/schema-entities-idx.sql"
  52 + , "sql/system-data.sql"
  53 + , "sql/system-test-psql.sql"
  54 + ),
  55 + "sql/psql/drop-all-tables.sql",
  56 + "psql-test.properties"
  57 + );
  58 +
  59 +// @ClassRule
  60 +// public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
  61 +// Arrays.asList("sql/schema-ts-psql.sql"
  62 +// , "sql/schema-entities.sql", "sql/schema-entities-idx.sql"
  63 +// , "sql/system-data.sql", "sql/system-test.sql"
  64 +// ),
  65 +// "sql/psql/drop-all-tables.sql",
  66 +// "sql-test.properties"
  67 +// );
  68 +
  69 +// @ClassRule
  70 +// public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
  71 +// Arrays.asList("sql/schema-timescale.sql", "sql/schema-entities.sql", "sql/schema-entities-idx.sql", "sql/system-data.sql", "sql/system-test.sql"),
  72 +// "sql/timescale/drop-all-tables.sql",
  73 +// "sql-test.properties"
  74 +// );
  75 +
  76 +}
... ...
... ... @@ -17,15 +17,18 @@ package org.thingsboard.server.dao.service;
17 17
18 18 import com.google.common.util.concurrent.Futures;
19 19 import com.google.common.util.concurrent.ListenableFuture;
  20 +import lombok.extern.slf4j.Slf4j;
20 21 import org.apache.commons.lang3.RandomStringUtils;
21 22 import org.apache.commons.lang3.RandomUtils;
22 23 import org.hamcrest.Matchers;
  24 +import org.jetbrains.annotations.NotNull;
23 25 import org.junit.After;
24 26 import org.junit.Assert;
25 27 import org.junit.Before;
26 28 import org.junit.Test;
27 29 import org.springframework.beans.factory.annotation.Autowired;
28 30 import org.springframework.jdbc.core.JdbcTemplate;
  31 +import org.springframework.jdbc.core.ResultSetExtractor;
29 32 import org.thingsboard.server.common.data.DataConstants;
30 33 import org.thingsboard.server.common.data.Device;
31 34 import org.thingsboard.server.common.data.EntityType;
... ... @@ -80,14 +83,17 @@ import java.util.Comparator;
80 83 import java.util.List;
81 84 import java.util.Random;
82 85 import java.util.concurrent.ExecutionException;
  86 +import java.util.concurrent.atomic.AtomicInteger;
83 87 import java.util.stream.Collectors;
84 88 import java.util.stream.Stream;
85 89
86 90 import static org.junit.Assert.assertEquals;
87 91 import static org.hamcrest.MatcherAssert.assertThat;
88 92
  93 +@Slf4j
89 94 public abstract class BaseEntityServiceTest extends AbstractServiceTest {
90 95
  96 + static final int ENTITY_COUNT = 5;
91 97 @Autowired
92 98 private AttributesService attributesService;
93 99
... ... @@ -525,7 +531,7 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest {
525 531 }
526 532
527 533 private void createTestHierarchy(TenantId tenantId, List<Asset> assets, List<Device> devices, List<Long> consumptions, List<Long> highConsumptions, List<Long> temperatures, List<Long> highTemperatures) throws InterruptedException {
528   - for (int i = 0; i < 5; i++) {
  534 + for (int i = 0; i < ENTITY_COUNT; i++) {
529 535 Asset asset = new Asset();
530 536 asset.setTenantId(tenantId);
531 537 asset.setName("Asset" + i);
... ... @@ -535,18 +541,19 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest {
535 541 //TO make sure devices have different created time
536 542 Thread.sleep(1);
537 543 assets.add(asset);
538   - EntityRelation er = new EntityRelation();
539   - er.setFrom(tenantId);
540   - er.setTo(asset.getId());
541   - er.setType("Manages");
542   - er.setTypeGroup(RelationTypeGroup.COMMON);
543   - relationService.saveRelation(tenantId, er);
  544 + createRelation(tenantId, "Manages", tenantId, asset.getId());
544 545 long consumption = (long) (Math.random() * 100);
545 546 consumptions.add(consumption);
546 547 if (consumption > 50) {
547 548 highConsumptions.add(consumption);
548 549 }
549   - for (int j = 0; j < 5; j++) {
  550 +
  551 + //tenant -> asset : one-to-one but many edges
  552 + for (int n = 0; n < ENTITY_COUNT; n++) {
  553 + createRelation(tenantId, "UseCase-" + n, tenantId, asset.getId());
  554 + }
  555 +
  556 + for (int j = 0; j < ENTITY_COUNT; j++) {
550 557 Device device = new Device();
551 558 device.setTenantId(tenantId);
552 559 device.setName("A" + i + "Device" + j);
... ... @@ -556,27 +563,158 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest {
556 563 //TO make sure devices have different created time
557 564 Thread.sleep(1);
558 565 devices.add(device);
559   - er = new EntityRelation();
560   - er.setFrom(asset.getId());
561   - er.setTo(device.getId());
562   - er.setType("Contains");
563   - er.setTypeGroup(RelationTypeGroup.COMMON);
564   - relationService.saveRelation(tenantId, er);
  566 + createRelation(tenantId, "Contains", asset.getId(), device.getId());
565 567 long temperature = (long) (Math.random() * 100);
566 568 temperatures.add(temperature);
567 569 if (temperature > 45) {
568 570 highTemperatures.add(temperature);
569 571 }
  572 +
  573 + //asset -> device : one-to-one but many edges
  574 + for (int n = 0; n < ENTITY_COUNT; n++) {
  575 + createRelation(tenantId, "UseCase-" + n, asset.getId(), device.getId());
  576 + }
570 577 }
571 578 }
572 579
573   - createManyCustomRelationsBetweenTwoNodes(tenantId, "UseCase", assets, devices);
  580 + //asset -> device one-to-many shared with other assets
  581 + for (int n = 0; n < devices.size(); n = n + ENTITY_COUNT) {
  582 + createRelation(tenantId, "SharedWithAsset0", assets.get(0).getId(), devices.get(n).getId());
  583 + }
  584 +
  585 + //createManyCustomRelationsBetweenTwoNodes(tenantId, "UseCase", assets, devices);
574 586 createHorizontalRingRelations(tenantId, "Ring(Loop)-Ast", assets);
575 587 createLoopRelations(tenantId, "Loop-Tnt-Ast-Dev", tenantId, assets.get(0).getId(), devices.get(0).getId());
576 588 createLoopRelations(tenantId, "Loop-Tnt-Ast", tenantId, assets.get(1).getId());
577 589 createLoopRelations(tenantId, "Loop-Ast-Tnt-Ast", assets.get(2).getId(), tenantId, assets.get(3).getId());
578 590
579   - printAllRelations();
  591 + //testQuery();
  592 +
  593 + //printAllRelations();
  594 + }
  595 +
  596 + private void testQuery() {
  597 +
  598 + template.query("" +
  599 + " DROP TABLE IF EXISTS relation_test;\n" +
  600 + " CREATE TABLE IF NOT EXISTS relation_test\n" +
  601 + " (\n" +
  602 + " from_id uuid,\n" +
  603 + " from_type varchar(255),\n" +
  604 + " to_id uuid,\n" +
  605 + " to_type varchar(255),\n" +
  606 + " relation_type_group varchar(255),\n" +
  607 + " relation_type varchar(255),\n" +
  608 + " additional_info varchar,\n" +
  609 + " CONSTRAINT relation_test_pkey PRIMARY KEY (from_id, from_type, relation_type_group, relation_type, to_id, to_type)\n" +
  610 + " );\n", r -> null);
  611 +
  612 + log.error("insert test {}", (Object) template.query("" +
  613 + "INSERT INTO relation_test (from_id, from_type, to_id, to_type, relation_type_group, relation_type, additional_info) " +
  614 + " VALUES " +
  615 + " ('11111111-0f19-11ec-ba23-e981fc95500d', 'TENANT', '22222222-0f19-11ec-ba23-e981fc95500d', 'ASSET', 'COMMON', 'Contains', null),\n" +
  616 + " ('22222222-0f19-11ec-ba23-e981fc95500d', 'ASSET', '33333333-0f19-11ec-ba23-e981fc95500d', 'DEVICE', 'COMMON', 'Contains', null),\n" +
  617 + " ('33333333-0f19-11ec-ba23-e981fc95500d', 'DEVICE', '11111111-0f19-11ec-ba23-e981fc95500d', 'TENANT', 'COMMON', 'Contains', null);\n" +
  618 + ""
  619 + , r -> null));
  620 +
  621 +
  622 + //log.error("array_position hsql {}", template.queryForObject("select array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon') from relation_test", Long.class));
  623 +
  624 + log.error("array_position hsql {}", template.queryForObject("select position_array('mon' in ARRAY['sun','mon','tue']);", Long.class));
  625 + log.error("array_position psql {}", template.queryForObject("select array_position(ARRAY['sun','mon','tue'], 'mon');", Long.class));
  626 +
  627 + Long countTest = template.queryForObject("select count(*) from relation_test", Long.class);
  628 + log.error("count test {}", countTest);
  629 +
  630 + Long count = template.queryForObject("select count(*) from relation", Long.class);
  631 + log.error("count {}", count);
  632 +
  633 + List<List<String>> result = template.query("" +
  634 + "WITH RECURSIVE related_entities(from_id, from_type, to_id, to_type, lvl, path) " +
  635 + " AS (SELECT from_id, " +
  636 + " from_type, " +
  637 + " to_id, " +
  638 + " to_type, " +
  639 + " 1 as lvl, " +
  640 + " ARRAY [from_id] as path " +
  641 + " FROM relation_test r " +
  642 + " WHERE from_id = '11111111-0f19-11ec-ba23-e981fc95500d' " +
  643 + " and from_type = 'TENANT' " +
  644 + " and relation_type_group = 'COMMON' " +
  645 + " GROUP BY r.from_id, r.from_type, r.to_id, r.to_type , 1, ARRAY [from_id] " +
  646 + " UNION ALL " +
  647 + " SELECT r.from_id, " +
  648 + " r.from_type, " +
  649 + " r.to_id, " +
  650 + " r.to_type, " +
  651 + " (re.lvl + 1) as lvl, " +
  652 + " (re.path || ARRAY [r.from_id]) as path " +
  653 + " FROM relation_test r " +
  654 + " INNER JOIN related_entities re " +
  655 + " ON r.from_id = re.to_id and " +
  656 + " r.from_type = re.to_type and " +
  657 + " relation_type_group = 'COMMON' and " +
  658 + " r.from_id NOT IN (SELECT * FROM unnest(re.path)) and " +
  659 + " re.lvl <= 7 " +
  660 + " GROUP BY r.from_id, r.from_type, r.to_id, r.to_type, " +
  661 + " (re.lvl + 1), (re.path || ARRAY [r.from_id])) " +
  662 + " " +
  663 + " SELECT lvl, from_id, from_type, to_id, to_type, path " + //to_id IN (SELECT * FROM unnest(path)) as is_present,
  664 + " from related_entities r_int " +
  665 + " " +
  666 + " ",
  667 + getListResultSetExtractor());
  668 +
  669 + log.error("result {}", result.size() - 1);
  670 + AtomicInteger counter = new AtomicInteger();
  671 + result.forEach(r -> System.out.printf("%s %s\n", counter.incrementAndGet(), r.toString()));
  672 + log.error("end");
  673 +
  674 + log.error("query 1 (expected true): {}", template.queryForObject(
  675 + "SELECT UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3') NOT IN (SELECT * FROM unnest(ARRAY[UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3'), UUID('46957d30-0f38-11ec-8153-55a9f38b54f3')])) ",
  676 + String.class));
  677 + log.error("query 1.1 (expected true): {}", template.queryForObject(
  678 + "SELECT UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3') NOT IN (SELECT * FROM unnest(ARRAY[UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3')] || ARRAY[UUID('46957d30-0f38-11ec-8153-55a9f38b54f3')] )) ",
  679 + String.class));
  680 + log.error("query 2 (expected true): {}", template.queryForObject(
  681 + "SELECT UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3') NOT IN (SELECT UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3')) ",
  682 + String.class));
  683 +// log.error("query true3: ", template.queryForObject(
  684 +// "SELECT '463e5c80-0f38-11ec-8153-55a9f38b54f3' IN (SELECT UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3')) ",
  685 +// String.class));
  686 + log.error("query 3 (expected true): {} ", template.queryForObject(
  687 + "SELECT '463e5c80-0f38-11ec-8153-55a9f38b54f3' NOT IN (SELECT '463e5c80-0f38-11ec-8153-55a9f38b54f3') ",
  688 + String.class));
  689 +
  690 + List<List<String>> result2 = template.query("SELECT * FROM unnest(ARRAY[UUID('463e5c80-0f38-11ec-8153-55a9f38b54f3'), UUID('46957d30-0f38-11ec-8153-55a9f38b54f3')]) "
  691 + , getListResultSetExtractor());
  692 + log.error("result2 {}", result2.size() - 1);
  693 + AtomicInteger counter2 = new AtomicInteger();
  694 + result2.forEach(r -> System.out.printf("%s %s\n", counter2.incrementAndGet(), r.toString()));
  695 + log.error("end2");
  696 +
  697 + }
  698 +
  699 + @NotNull
  700 + private ResultSetExtractor<List<List<String>>> getListResultSetExtractor() {
  701 + return rs -> {
  702 + List<List<String>> list = new ArrayList<>();
  703 + final int columnCount = rs.getMetaData().getColumnCount();
  704 + List<String> columns = new ArrayList<>(columnCount);
  705 + for (int i = 1; i <= columnCount; i++) {
  706 + columns.add(rs.getMetaData().getColumnName(i));
  707 + }
  708 + list.add(columns);
  709 + while (rs.next()) {
  710 + List<String> data = new ArrayList<>(columnCount);
  711 + for (int i = 1; i <= columnCount; i++) {
  712 + data.add(rs.getString(i));
  713 + }
  714 + list.add(data);
  715 + }
  716 + return list;
  717 + };
580 718 }
581 719
582 720 /*
... ... @@ -642,9 +780,14 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest {
642 780 }
643 781
644 782 void createOneToManyRelations(TenantId tenantId, String type, EntityId from, List<EntityId> toIds) {
645   - toIds.forEach(toId -> relationService.saveRelation(tenantId, new EntityRelation(from, toId, type, RelationTypeGroup.COMMON)));
  783 + toIds.forEach(toId -> createRelation(tenantId, type, from, toId));
  784 + }
  785 +
  786 + void createRelation(TenantId tenantId, String type, EntityId from, EntityId toId) {
  787 + relationService.saveRelation(tenantId, new EntityRelation(from, toId, type, RelationTypeGroup.COMMON));
646 788 }
647 789
  790 +
648 791 @Test
649 792 public void testSimpleFindEntityDataByQuery() throws InterruptedException {
650 793 List<Device> devices = new ArrayList<>();
... ...
  1 +/**
  2 + * ThingsBoard, Inc. ("COMPANY") CONFIDENTIAL
  3 + *
  4 + * Copyright © 2016-2021 ThingsBoard, Inc. All Rights Reserved.
  5 + *
  6 + * NOTICE: All information contained herein is, and remains
  7 + * the property of ThingsBoard, Inc. and its suppliers,
  8 + * if any. The intellectual and technical concepts contained
  9 + * herein are proprietary to ThingsBoard, Inc.
  10 + * and its suppliers and may be covered by U.S. and Foreign Patents,
  11 + * patents in process, and are protected by trade secret or copyright law.
  12 + *
  13 + * Dissemination of this information or reproduction of this material is strictly forbidden
  14 + * unless prior written permission is obtained from COMPANY.
  15 + *
  16 + * Access to the source code contained herein is hereby forbidden to anyone except current COMPANY employees,
  17 + * managers or contractors who have executed Confidentiality and Non-disclosure agreements
  18 + * explicitly covering such access.
  19 + *
  20 + * The copyright notice above does not evidence any actual or intended publication
  21 + * or disclosure of this source code, which includes
  22 + * information that is confidential and/or proprietary, and is a trade secret, of COMPANY.
  23 + * ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
  24 + * OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT
  25 + * THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED,
  26 + * AND IN VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES.
  27 + * THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION
  28 + * DOES NOT CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS,
  29 + * OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
  30 + */
  31 +package org.thingsboard.server.dao.service;
  32 +
  33 +import org.springframework.test.context.TestPropertySource;
  34 +
  35 +import java.lang.annotation.Documented;
  36 +import java.lang.annotation.ElementType;
  37 +import java.lang.annotation.Inherited;
  38 +import java.lang.annotation.Retention;
  39 +import java.lang.annotation.RetentionPolicy;
  40 +import java.lang.annotation.Target;
  41 +
  42 +@Target(ElementType.TYPE)
  43 +@Retention(RetentionPolicy.RUNTIME)
  44 +@Inherited
  45 +@Documented
  46 +@TestPropertySource(locations = {"classpath:application-test.properties", "classpath:psql-test.properties"})
  47 +public @interface DaoPostgreSqlTest {
  48 +}
... ...
dao/src/test/java/org/thingsboard/server/dao/service/psql/EntityServicePostgreSqlTest.java renamed from dao/src/test/java/org/thingsboard/server/dao/service/sql/EntityServiceSqlTest.java
... ... @@ -13,11 +13,11 @@
13 13 * See the License for the specific language governing permissions and
14 14 * limitations under the License.
15 15 */
16   -package org.thingsboard.server.dao.service.sql;
  16 +package org.thingsboard.server.dao.service.psql;
17 17
18 18 import org.thingsboard.server.dao.service.BaseEntityServiceTest;
19   -import org.thingsboard.server.dao.service.DaoSqlTest;
  19 +import org.thingsboard.server.dao.service.DaoPostgreSqlTest;
20 20
21   -@DaoSqlTest
22   -public class EntityServiceSqlTest extends BaseEntityServiceTest {
  21 +@DaoPostgreSqlTest
  22 +public class EntityServicePostgreSqlTest extends BaseEntityServiceTest {
23 23 }
... ...
  1 +database.ts.type=sql
  2 +database.ts_latest.type=sql
  3 +sql.ts_inserts_executor_type=fixed
  4 +sql.ts_inserts_fixed_thread_pool_size=200
  5 +sql.ts_key_value_partitioning=MONTHS
  6 +#
  7 +spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
  8 +spring.jpa.properties.hibernate.order_by.default_null_ordering=last
  9 +spring.jpa.properties.hibernate.jdbc.log.warnings=false
  10 +spring.jpa.show-sql=false
  11 +spring.jpa.hibernate.ddl-auto=none
  12 +spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
  13 +spring.datasource.username=postgres
  14 +spring.datasource.password=postgres
  15 +spring.datasource.url=jdbc:tc:postgresql:12.8:///thingsboard?TC_DAEMON=true&TC_TMPFS=/testtmpfs:rw
  16 +spring.datasource.driverClassName=org.testcontainers.jdbc.ContainerDatabaseDriver
  17 +#org.postgresql.Driver
  18 +spring.datasource.hikari.maximumPoolSize=20
  19 +service.type=monolith
  20 +#database.ts.type=timescale
  21 +#database.ts.type=sql
  22 +#database.entities.type=sql
  23 +#
  24 +#sql.ts_inserts_executor_type=fixed
  25 +#sql.ts_inserts_fixed_thread_pool_size=200
  26 +#sql.ts_key_value_partitioning=MONTHS
  27 +#
  28 +#spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
  29 +#spring.jpa.show-sql=false
  30 +#spring.jpa.hibernate.ddl-auto=none
  31 +#spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
  32 +#
  33 +#spring.datasource.username=postgres
  34 +#spring.datasource.password=postgres
  35 +#spring.datasource.url=jdbc:postgresql://localhost:5432/sqltest
  36 +#spring.datasource.driverClassName=org.postgresql.Driver
  37 +#spring.datasource.hikari.maximumPoolSize = 50
  38 +queue.core.pack-processing-timeout=3000
  39 +queue.rule-engine.pack-processing-timeout=3000
  40 +queue.rule-engine.queues[0].name=Main
  41 +queue.rule-engine.queues[0].topic=tb_rule_engine.main
  42 +queue.rule-engine.queues[0].poll-interval=25
  43 +queue.rule-engine.queues[0].partitions=3
  44 +queue.rule-engine.queues[0].pack-processing-timeout=3000
  45 +queue.rule-engine.queues[0].processing-strategy.type=SKIP_ALL_FAILURES
  46 +queue.rule-engine.queues[0].submit-strategy.type=BURST
  47 +sql.log_entity_queries=true
... ...
  1 +--PostgreSQL specific truncate to fit constraints
  2 +TRUNCATE TABLE device_credentials, device, device_profile, rule_node_state, rule_node, rule_chain;
\ No newline at end of file
... ...
... ... @@ -1637,6 +1637,17 @@
1637 1637 <groupId>org.hsqldb</groupId>
1638 1638 <artifactId>hsqldb</artifactId>
1639 1639 <version>${hsqldb.version}</version>
  1640 + </dependency>
  1641 + <dependency>
  1642 + <groupId>org.testcontainers</groupId>
  1643 + <artifactId>postgresql</artifactId>
  1644 + <version>${testcontainers.version}</version>
  1645 + <scope>test</scope>
  1646 + </dependency>
  1647 + <dependency>
  1648 + <groupId>org.testcontainers</groupId>
  1649 + <artifactId>jdbc</artifactId>
  1650 + <version>${testcontainers.version}</version>
1640 1651 <scope>test</scope>
1641 1652 </dependency>
1642 1653 <dependency>
... ...