Commit f274c72f14e3b306d8a6c006da1bffdf80a0b011
Committed by
GitHub
Merge pull request #192 from volodymyr-babak/sql-dao-improvements
Unifying SQL DAO
Showing
66 changed files
with
855 additions
and
117 deletions
.mvn/jvm.config
deleted
100644 → 0
1 | --Xmx4096m -Xms1024m |
@@ -250,8 +250,8 @@ | @@ -250,8 +250,8 @@ | ||
250 | <scope>test</scope> | 250 | <scope>test</scope> |
251 | </dependency> | 251 | </dependency> |
252 | <dependency> | 252 | <dependency> |
253 | - <groupId>ru.yandex.qatools.embed</groupId> | ||
254 | - <artifactId>postgresql-embedded</artifactId> | 253 | + <groupId>org.hsqldb</groupId> |
254 | + <artifactId>hsqldb</artifactId> | ||
255 | <scope>test</scope> | 255 | <scope>test</scope> |
256 | </dependency> | 256 | </dependency> |
257 | </dependencies> | 257 | </dependencies> |
@@ -106,7 +106,7 @@ coap: | @@ -106,7 +106,7 @@ coap: | ||
106 | timeout: "${COAP_TIMEOUT:10000}" | 106 | timeout: "${COAP_TIMEOUT:10000}" |
107 | 107 | ||
108 | database: | 108 | database: |
109 | - type: "${DATABASE_TYPE:cassandra}" # cassandra OR postgres | 109 | + type: "${DATABASE_TYPE:cassandra}" # cassandra OR sql |
110 | 110 | ||
111 | # Cassandra driver configuration parameters | 111 | # Cassandra driver configuration parameters |
112 | cassandra: | 112 | cassandra: |
@@ -233,7 +233,6 @@ spring: | @@ -233,7 +233,6 @@ spring: | ||
233 | enabled: "true" | 233 | enabled: "true" |
234 | jpa: | 234 | jpa: |
235 | show-sql: "false" | 235 | show-sql: "false" |
236 | - generate-ddl: "true" | ||
237 | database-platform: "org.hibernate.dialect.PostgreSQLDialect" | 236 | database-platform: "org.hibernate.dialect.PostgreSQLDialect" |
238 | hibernate: | 237 | hibernate: |
239 | ddl-auto: "validate" | 238 | ddl-auto: "validate" |
@@ -80,7 +80,6 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC | @@ -80,7 +80,6 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC | ||
80 | @ActiveProfiles("test") | 80 | @ActiveProfiles("test") |
81 | @RunWith(SpringRunner.class) | 81 | @RunWith(SpringRunner.class) |
82 | @ContextConfiguration(classes = AbstractControllerTest.class, loader = SpringBootContextLoader.class) | 82 | @ContextConfiguration(classes = AbstractControllerTest.class, loader = SpringBootContextLoader.class) |
83 | -@TestPropertySource(locations = {"classpath:cassandra-test.properties", "classpath:application-test.properties", "classpath:nosql-test.properties"}) | ||
84 | @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) | 83 | @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) |
85 | @Configuration | 84 | @Configuration |
86 | @ComponentScan({"org.thingsboard.server"}) | 85 | @ComponentScan({"org.thingsboard.server"}) |
application/src/test/java/org/thingsboard/server/controller/BaseAdminControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/AdminControllerTest.java
@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.JsonNode; | @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.JsonNode; | ||
29 | import com.fasterxml.jackson.databind.ObjectMapper; | 29 | import com.fasterxml.jackson.databind.ObjectMapper; |
30 | import com.fasterxml.jackson.databind.node.ObjectNode; | 30 | import com.fasterxml.jackson.databind.node.ObjectNode; |
31 | 31 | ||
32 | -public class AdminControllerTest extends AbstractControllerTest { | 32 | +public abstract class BaseAdminControllerTest extends AbstractControllerTest { |
33 | 33 | ||
34 | @Test | 34 | @Test |
35 | public void testFindAdminSettingsByKey() throws Exception { | 35 | public void testFindAdminSettingsByKey() throws Exception { |
application/src/test/java/org/thingsboard/server/controller/BaseAssetControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/AssetControllerTest.java
@@ -40,7 +40,7 @@ import org.junit.Test; | @@ -40,7 +40,7 @@ import org.junit.Test; | ||
40 | import com.datastax.driver.core.utils.UUIDs; | 40 | import com.datastax.driver.core.utils.UUIDs; |
41 | import com.fasterxml.jackson.core.type.TypeReference; | 41 | import com.fasterxml.jackson.core.type.TypeReference; |
42 | 42 | ||
43 | -public class AssetControllerTest extends AbstractControllerTest { | 43 | +public abstract class BaseAssetControllerTest extends AbstractControllerTest { |
44 | 44 | ||
45 | private IdComparator<Asset> idComparator = new IdComparator<>(); | 45 | private IdComparator<Asset> idComparator = new IdComparator<>(); |
46 | 46 |
application/src/test/java/org/thingsboard/server/controller/BaseAuthControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java
@@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. | @@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. | ||
22 | import org.thingsboard.server.common.data.security.Authority; | 22 | import org.thingsboard.server.common.data.security.Authority; |
23 | import org.junit.Test; | 23 | import org.junit.Test; |
24 | 24 | ||
25 | -public class AuthControllerTest extends AbstractControllerTest { | 25 | +public abstract class BaseAuthControllerTest extends AbstractControllerTest { |
26 | 26 | ||
27 | @Test | 27 | @Test |
28 | public void testGetUser() throws Exception { | 28 | public void testGetUser() throws Exception { |
application/src/test/java/org/thingsboard/server/controller/BaseComponentDescriptorControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/ComponentDescriptorControllerTest.java
@@ -33,7 +33,7 @@ import java.util.List; | @@ -33,7 +33,7 @@ import java.util.List; | ||
33 | 33 | ||
34 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | 34 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
35 | 35 | ||
36 | -public class ComponentDescriptorControllerTest extends AbstractControllerTest { | 36 | +public abstract class BaseComponentDescriptorControllerTest extends AbstractControllerTest { |
37 | 37 | ||
38 | private static final int AMOUNT_OF_DEFAULT_PLUGINS_DESCRIPTORS = 5; | 38 | private static final int AMOUNT_OF_DEFAULT_PLUGINS_DESCRIPTORS = 5; |
39 | private Tenant savedTenant; | 39 | private Tenant savedTenant; |
application/src/test/java/org/thingsboard/server/controller/BaseCustomerControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/CustomerControllerTest.java
@@ -35,7 +35,7 @@ import org.junit.Test; | @@ -35,7 +35,7 @@ import org.junit.Test; | ||
35 | 35 | ||
36 | import com.fasterxml.jackson.core.type.TypeReference; | 36 | import com.fasterxml.jackson.core.type.TypeReference; |
37 | 37 | ||
38 | -public class CustomerControllerTest extends AbstractControllerTest { | 38 | +public abstract class BaseCustomerControllerTest extends AbstractControllerTest { |
39 | 39 | ||
40 | private IdComparator<Customer> idComparator = new IdComparator<>(); | 40 | private IdComparator<Customer> idComparator = new IdComparator<>(); |
41 | 41 |
application/src/test/java/org/thingsboard/server/controller/BaseDashboardControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/DashboardControllerTest.java
@@ -38,7 +38,7 @@ import org.junit.Test; | @@ -38,7 +38,7 @@ import org.junit.Test; | ||
38 | 38 | ||
39 | import com.fasterxml.jackson.core.type.TypeReference; | 39 | import com.fasterxml.jackson.core.type.TypeReference; |
40 | 40 | ||
41 | -public class DashboardControllerTest extends AbstractControllerTest { | 41 | +public abstract class BaseDashboardControllerTest extends AbstractControllerTest { |
42 | 42 | ||
43 | private IdComparator<DashboardInfo> idComparator = new IdComparator<>(); | 43 | private IdComparator<DashboardInfo> idComparator = new IdComparator<>(); |
44 | 44 |
application/src/test/java/org/thingsboard/server/controller/BaseDeviceControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java
@@ -42,7 +42,7 @@ import org.junit.Test; | @@ -42,7 +42,7 @@ import org.junit.Test; | ||
42 | 42 | ||
43 | import com.fasterxml.jackson.core.type.TypeReference; | 43 | import com.fasterxml.jackson.core.type.TypeReference; |
44 | 44 | ||
45 | -public class DeviceControllerTest extends AbstractControllerTest { | 45 | +public abstract class BaseDeviceControllerTest extends AbstractControllerTest { |
46 | 46 | ||
47 | private IdComparator<Device> idComparator = new IdComparator<>(); | 47 | private IdComparator<Device> idComparator = new IdComparator<>(); |
48 | 48 |
application/src/test/java/org/thingsboard/server/controller/BasePluginControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/PluginControllerTest.java
@@ -37,7 +37,7 @@ import java.util.stream.Collectors; | @@ -37,7 +37,7 @@ import java.util.stream.Collectors; | ||
37 | 37 | ||
38 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | 38 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
39 | 39 | ||
40 | -public class PluginControllerTest extends AbstractControllerTest { | 40 | +public abstract class BasePluginControllerTest extends AbstractControllerTest { |
41 | 41 | ||
42 | private IdComparator<PluginMetaData> idComparator = new IdComparator<>(); | 42 | private IdComparator<PluginMetaData> idComparator = new IdComparator<>(); |
43 | 43 | ||
@@ -130,7 +130,7 @@ public class PluginControllerTest extends AbstractControllerTest { | @@ -130,7 +130,7 @@ public class PluginControllerTest extends AbstractControllerTest { | ||
130 | 130 | ||
131 | doPost("/api/plugin/" + savedPlugin.getId().getId().toString() + "/activate").andExpect(status().isOk()); | 131 | doPost("/api/plugin/" + savedPlugin.getId().getId().toString() + "/activate").andExpect(status().isOk()); |
132 | 132 | ||
133 | - RuleMetaData rule = RuleControllerTest.createRuleMetaData(savedPlugin); | 133 | + RuleMetaData rule = BaseRuleControllerTest.createRuleMetaData(savedPlugin); |
134 | RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); | 134 | RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); |
135 | doPost("/api/rule/" + savedRule.getId().getId().toString() + "/activate").andExpect(status().isOk()); | 135 | doPost("/api/rule/" + savedRule.getId().getId().toString() + "/activate").andExpect(status().isOk()); |
136 | 136 | ||
@@ -151,7 +151,7 @@ public class PluginControllerTest extends AbstractControllerTest { | @@ -151,7 +151,7 @@ public class PluginControllerTest extends AbstractControllerTest { | ||
151 | 151 | ||
152 | PluginMetaData savedPlugin = doPost("/api/plugin", plugin, PluginMetaData.class); | 152 | PluginMetaData savedPlugin = doPost("/api/plugin", plugin, PluginMetaData.class); |
153 | 153 | ||
154 | - RuleMetaData rule = RuleControllerTest.createRuleMetaData(savedPlugin); | 154 | + RuleMetaData rule = BaseRuleControllerTest.createRuleMetaData(savedPlugin); |
155 | RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); | 155 | RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); |
156 | 156 | ||
157 | doDelete("/api/plugin/" + savedPlugin.getId().getId()).andExpect(status().isBadRequest()); | 157 | doDelete("/api/plugin/" + savedPlugin.getId().getId()).andExpect(status().isBadRequest()); |
application/src/test/java/org/thingsboard/server/controller/BaseRuleControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/RuleControllerTest.java
@@ -38,7 +38,7 @@ import java.util.stream.Collectors; | @@ -38,7 +38,7 @@ import java.util.stream.Collectors; | ||
38 | 38 | ||
39 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | 39 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
40 | 40 | ||
41 | -public class RuleControllerTest extends AbstractControllerTest { | 41 | +public abstract class BaseRuleControllerTest extends AbstractControllerTest { |
42 | 42 | ||
43 | private IdComparator<RuleMetaData> idComparator = new IdComparator<>(); | 43 | private IdComparator<RuleMetaData> idComparator = new IdComparator<>(); |
44 | 44 |
application/src/test/java/org/thingsboard/server/controller/BaseTenantControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/TenantControllerTest.java
@@ -31,7 +31,7 @@ import org.junit.Test; | @@ -31,7 +31,7 @@ import org.junit.Test; | ||
31 | 31 | ||
32 | import com.fasterxml.jackson.core.type.TypeReference; | 32 | import com.fasterxml.jackson.core.type.TypeReference; |
33 | 33 | ||
34 | -public class TenantControllerTest extends AbstractControllerTest { | 34 | +public abstract class BaseTenantControllerTest extends AbstractControllerTest { |
35 | 35 | ||
36 | private IdComparator<Tenant> idComparator = new IdComparator<>(); | 36 | private IdComparator<Tenant> idComparator = new IdComparator<>(); |
37 | 37 | ||
@@ -107,7 +107,7 @@ public class TenantControllerTest extends AbstractControllerTest { | @@ -107,7 +107,7 @@ public class TenantControllerTest extends AbstractControllerTest { | ||
107 | Assert.assertFalse(pageData.hasNext()); | 107 | Assert.assertFalse(pageData.hasNext()); |
108 | Assert.assertEquals(1, pageData.getData().size()); | 108 | Assert.assertEquals(1, pageData.getData().size()); |
109 | tenants.addAll(pageData.getData()); | 109 | tenants.addAll(pageData.getData()); |
110 | - | 110 | + |
111 | for (int i=0;i<56;i++) { | 111 | for (int i=0;i<56;i++) { |
112 | Tenant tenant = new Tenant(); | 112 | Tenant tenant = new Tenant(); |
113 | tenant.setTitle("Tenant"+i); | 113 | tenant.setTitle("Tenant"+i); |
application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/UserControllerTest.java
@@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.containsString; | @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.containsString; | ||
39 | import static org.hamcrest.Matchers.is; | 39 | import static org.hamcrest.Matchers.is; |
40 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; | 40 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
41 | 41 | ||
42 | -public class UserControllerTest extends AbstractControllerTest { | 42 | +public abstract class BaseUserControllerTest extends AbstractControllerTest { |
43 | 43 | ||
44 | private IdComparator<User> idComparator = new IdComparator<>(); | 44 | private IdComparator<User> idComparator = new IdComparator<>(); |
45 | 45 |
application/src/test/java/org/thingsboard/server/controller/BaseWidgetTypeControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/WidgetTypeControllerTest.java
@@ -35,7 +35,7 @@ import java.util.List; | @@ -35,7 +35,7 @@ import java.util.List; | ||
35 | import static org.hamcrest.Matchers.containsString; | 35 | import static org.hamcrest.Matchers.containsString; |
36 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | 36 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
37 | 37 | ||
38 | -public class WidgetTypeControllerTest extends AbstractControllerTest { | 38 | +public abstract class BaseWidgetTypeControllerTest extends AbstractControllerTest { |
39 | 39 | ||
40 | private IdComparator<WidgetType> idComparator = new IdComparator<>(); | 40 | private IdComparator<WidgetType> idComparator = new IdComparator<>(); |
41 | 41 |
application/src/test/java/org/thingsboard/server/controller/BaseWidgetsBundleControllerTest.java
renamed from
application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java
@@ -34,7 +34,7 @@ import java.util.List; | @@ -34,7 +34,7 @@ import java.util.List; | ||
34 | import static org.hamcrest.Matchers.containsString; | 34 | import static org.hamcrest.Matchers.containsString; |
35 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | 35 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
36 | 36 | ||
37 | -public class WidgetsBundleControllerTest extends AbstractControllerTest { | 37 | +public abstract class BaseWidgetsBundleControllerTest extends AbstractControllerTest { |
38 | 38 | ||
39 | private IdComparator<WidgetsBundle> idComparator = new IdComparator<>(); | 39 | private IdComparator<WidgetsBundle> idComparator = new IdComparator<>(); |
40 | 40 |
application/src/test/java/org/thingsboard/server/controller/ControllerNoSqlTestSuite.java
renamed from
application/src/test/java/org/thingsboard/server/controller/ControllerTestSuite.java
@@ -25,8 +25,8 @@ import java.util.Arrays; | @@ -25,8 +25,8 @@ import java.util.Arrays; | ||
25 | 25 | ||
26 | @RunWith(ClasspathSuite.class) | 26 | @RunWith(ClasspathSuite.class) |
27 | @ClasspathSuite.ClassnameFilters({ | 27 | @ClasspathSuite.ClassnameFilters({ |
28 | - "org.thingsboard.server.controller.*Test"}) | ||
29 | -public class ControllerTestSuite { | 28 | + "org.thingsboard.server.controller.nosql.*Test"}) |
29 | +public class ControllerNoSqlTestSuite { | ||
30 | 30 | ||
31 | @ClassRule | 31 | @ClassRule |
32 | public static CustomCassandraCQLUnit cassandraUnit = | 32 | public static CustomCassandraCQLUnit cassandraUnit = |
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller; | ||
17 | + | ||
18 | +import org.junit.ClassRule; | ||
19 | +import org.junit.extensions.cpsuite.ClasspathSuite; | ||
20 | +import org.junit.runner.RunWith; | ||
21 | +import org.thingsboard.server.dao.CustomSqlUnit; | ||
22 | + | ||
23 | +import java.util.Arrays; | ||
24 | + | ||
25 | +@RunWith(ClasspathSuite.class) | ||
26 | +@ClasspathSuite.ClassnameFilters({ | ||
27 | + "org.thingsboard.server.controller.sql.*SqlTest", | ||
28 | + }) | ||
29 | +public class ControllerSqlTestSuite { | ||
30 | + | ||
31 | + @ClassRule | ||
32 | + public static CustomSqlUnit sqlUnit = new CustomSqlUnit( | ||
33 | + Arrays.asList("sql/schema.sql", "sql/system-data.sql"), | ||
34 | + "sql/drop-all-tables.sql", | ||
35 | + "sql-test.properties"); | ||
36 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/AdminControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseAdminControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class AdminControllerNoSqlTest extends BaseAdminControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/AssetControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseAssetControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | +import org.thingsboard.server.dao.util.NoSqlDao; | ||
21 | + | ||
22 | +/** | ||
23 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
24 | + */ | ||
25 | +@DaoNoSqlTest | ||
26 | +public class AssetControllerNoSqlTest extends BaseAssetControllerTest { | ||
27 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/AuthControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseAuthControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class AuthControllerNoSqlTest extends BaseAuthControllerTest { | ||
26 | +} |
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseComponentDescriptorControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class ComponentDescriptorControllerNoSqlTest extends BaseComponentDescriptorControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/CustomerControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseCustomerControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class CustomerControllerNoSqlTest extends BaseCustomerControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/DashboardControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseDashboardControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class DashboardControllerNoSqlTest extends BaseDashboardControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/DeviceControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseDeviceControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class DeviceControllerNoSqlTest extends BaseDeviceControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/PluginControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BasePluginControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class PluginControllerNoSqlTest extends BasePluginControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/RuleControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseRuleControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class RuleControllerNoSqlTest extends BaseRuleControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/TenantControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseTenantControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class TenantControllerNoSqlTest extends BaseTenantControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/UserControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseUserControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class UserControllerNoSqlTest extends BaseUserControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/nosql/WidgetTypeControllerNoSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseWidgetTypeControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class WidgetTypeControllerNoSqlTest extends BaseWidgetTypeControllerTest { | ||
26 | +} |
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.nosql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseWidgetsBundleControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoNoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoNoSqlTest | ||
25 | +public class WidgetsBundleControllerNoSqlTest extends BaseWidgetsBundleControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/AdminControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseAdminControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class AdminControllerSqlTest extends BaseAdminControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/AssetControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseAssetControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class AssetControllerSqlTest extends BaseAssetControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/AuthControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseAuthControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class AuthControllerSqlTest extends BaseAuthControllerTest { | ||
26 | +} |
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseComponentDescriptorControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class ComponentDescriptorControllerSqlTest extends BaseComponentDescriptorControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/CustomerControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseCustomerControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class CustomerControllerSqlTest extends BaseCustomerControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/DashboardControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseDashboardControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class DashboardControllerSqlTest extends BaseDashboardControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/DeviceControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseDeviceControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class DeviceControllerSqlTest extends BaseDeviceControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/PluginControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BasePluginControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class PluginControllerSqlTest extends BasePluginControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/RuleControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseRuleControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class RuleControllerSqlTest extends BaseRuleControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/TenantControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseTenantControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class TenantControllerSqlTest extends BaseTenantControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/UserControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseUserControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class UserControllerSqlTest extends BaseUserControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/WidgetTypeControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseWidgetTypeControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class WidgetTypeControllerSqlTest extends BaseWidgetTypeControllerTest { | ||
26 | +} |
application/src/test/java/org/thingsboard/server/controller/sql/WidgetsBundleControllerSqlTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2017 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.controller.sql; | ||
17 | + | ||
18 | +import org.thingsboard.server.controller.BaseWidgetsBundleControllerTest; | ||
19 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by Valerii Sosliuk on 6/28/2017. | ||
23 | + */ | ||
24 | +@DaoSqlTest | ||
25 | +public class WidgetsBundleControllerSqlTest extends BaseWidgetsBundleControllerTest { | ||
26 | +} |
@@ -18,7 +18,7 @@ package org.thingsboard.server.system; | @@ -18,7 +18,7 @@ package org.thingsboard.server.system; | ||
18 | import org.junit.ClassRule; | 18 | import org.junit.ClassRule; |
19 | import org.junit.extensions.cpsuite.ClasspathSuite; | 19 | import org.junit.extensions.cpsuite.ClasspathSuite; |
20 | import org.junit.runner.RunWith; | 20 | import org.junit.runner.RunWith; |
21 | -import org.thingsboard.server.dao.CustomPostgresUnit; | 21 | +import org.thingsboard.server.dao.CustomSqlUnit; |
22 | 22 | ||
23 | import java.util.Arrays; | 23 | import java.util.Arrays; |
24 | 24 | ||
@@ -30,9 +30,10 @@ import java.util.Arrays; | @@ -30,9 +30,10 @@ import java.util.Arrays; | ||
30 | public class SystemSqlTestSuite { | 30 | public class SystemSqlTestSuite { |
31 | 31 | ||
32 | @ClassRule | 32 | @ClassRule |
33 | - public static CustomPostgresUnit postgresUnit = new CustomPostgresUnit( | ||
34 | - Arrays.asList("postgres/schema.sql", "postgres/system-data.sql"), | ||
35 | - "postgres-embedded-test.properties"); | 33 | + public static CustomSqlUnit sqlUnit = new CustomSqlUnit( |
34 | + Arrays.asList("sql/schema.sql", "sql/system-data.sql"), | ||
35 | + "sql/drop-all-tables.sql", | ||
36 | + "sql-test.properties"); | ||
36 | 37 | ||
37 | 38 | ||
38 | } | 39 | } |
@@ -22,5 +22,5 @@ import org.thingsboard.server.system.BaseHttpDeviceApiTest; | @@ -22,5 +22,5 @@ import org.thingsboard.server.system.BaseHttpDeviceApiTest; | ||
22 | * Created by Valerii Sosliuk on 6/27/2017. | 22 | * Created by Valerii Sosliuk on 6/27/2017. |
23 | */ | 23 | */ |
24 | @DaoSqlTest | 24 | @DaoSqlTest |
25 | -public class DeviceApiSqlTest extends BaseHttpDeviceApiTest{ | 25 | +public class DeviceApiSqlTest extends BaseHttpDeviceApiTest { |
26 | } | 26 | } |
@@ -170,8 +170,8 @@ | @@ -170,8 +170,8 @@ | ||
170 | <scope>test</scope> | 170 | <scope>test</scope> |
171 | </dependency> | 171 | </dependency> |
172 | <dependency> | 172 | <dependency> |
173 | - <groupId>ru.yandex.qatools.embed</groupId> | ||
174 | - <artifactId>postgresql-embedded</artifactId> | 173 | + <groupId>org.hsqldb</groupId> |
174 | + <artifactId>hsqldb</artifactId> | ||
175 | <scope>test</scope> | 175 | <scope>test</scope> |
176 | </dependency> | 176 | </dependency> |
177 | </dependencies> | 177 | </dependencies> |
@@ -45,7 +45,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> | @@ -45,7 +45,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> | ||
45 | protected void setSearchText(E entity) {} | 45 | protected void setSearchText(E entity) {} |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | - @Transactional(propagation = REQUIRES_NEW) | 48 | + @Transactional |
49 | public D save(D domain) { | 49 | public D save(D domain) { |
50 | E entity; | 50 | E entity; |
51 | try { | 51 | try { |
@@ -64,7 +64,6 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> | @@ -64,7 +64,6 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> | ||
64 | } | 64 | } |
65 | 65 | ||
66 | @Override | 66 | @Override |
67 | - @Transactional(propagation = REQUIRES_NEW) | ||
68 | public D findById(UUID key) { | 67 | public D findById(UUID key) { |
69 | log.debug("Get entity by key {}", key); | 68 | log.debug("Get entity by key {}", key); |
70 | E entity = getCrudRepository().findOne(key); | 69 | E entity = getCrudRepository().findOne(key); |
@@ -78,7 +77,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> | @@ -78,7 +77,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> | ||
78 | } | 77 | } |
79 | 78 | ||
80 | @Override | 79 | @Override |
81 | - @Transactional(propagation = REQUIRES_NEW) | 80 | + @Transactional |
82 | public boolean removeById(UUID key) { | 81 | public boolean removeById(UUID key) { |
83 | getCrudRepository().delete(key); | 82 | getCrudRepository().delete(key); |
84 | log.debug("Remove request: {}", key); | 83 | log.debug("Remove request: {}", key); |
@@ -73,7 +73,6 @@ public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements A | @@ -73,7 +73,6 @@ public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements A | ||
73 | } | 73 | } |
74 | 74 | ||
75 | @Override | 75 | @Override |
76 | - @Transactional(propagation = REQUIRES_NEW) | ||
77 | public ListenableFuture<Alarm> findLatestByOriginatorAndType(TenantId tenantId, EntityId originator, String type) { | 76 | public ListenableFuture<Alarm> findLatestByOriginatorAndType(TenantId tenantId, EntityId originator, String type) { |
78 | return service.submit(() -> { | 77 | return service.submit(() -> { |
79 | List<AlarmEntity> latest = alarmRepository.findLatestByOriginatorAndType( | 78 | List<AlarmEntity> latest = alarmRepository.findLatestByOriginatorAndType( |
@@ -80,7 +80,5 @@ public interface DeviceRepository extends CrudRepository<DeviceEntity, UUID> { | @@ -80,7 +80,5 @@ public interface DeviceRepository extends CrudRepository<DeviceEntity, UUID> { | ||
80 | 80 | ||
81 | List<DeviceEntity> findDevicesByTenantIdAndCustomerIdAndIdIn(UUID tenantId, UUID customerId, List<UUID> deviceIds); | 81 | List<DeviceEntity> findDevicesByTenantIdAndCustomerIdAndIdIn(UUID tenantId, UUID customerId, List<UUID> deviceIds); |
82 | 82 | ||
83 | - List<DeviceEntity> findDevicesByTenantId(UUID tenantId); | ||
84 | - | ||
85 | List<DeviceEntity> findDevicesByTenantIdAndIdIn(UUID tenantId, List<UUID> deviceIds); | 83 | List<DeviceEntity> findDevicesByTenantIdAndIdIn(UUID tenantId, List<UUID> deviceIds); |
86 | } | 84 | } |
@@ -30,12 +30,12 @@ import org.thingsboard.server.common.data.page.TimePageLink; | @@ -30,12 +30,12 @@ import org.thingsboard.server.common.data.page.TimePageLink; | ||
30 | import org.thingsboard.server.common.data.relation.EntityRelation; | 30 | import org.thingsboard.server.common.data.relation.EntityRelation; |
31 | import org.thingsboard.server.common.data.relation.RelationTypeGroup; | 31 | import org.thingsboard.server.common.data.relation.RelationTypeGroup; |
32 | import org.thingsboard.server.dao.DaoUtil; | 32 | import org.thingsboard.server.dao.DaoUtil; |
33 | -import org.thingsboard.server.dao.util.SqlDao; | ||
34 | import org.thingsboard.server.dao.model.sql.RelationCompositeKey; | 33 | import org.thingsboard.server.dao.model.sql.RelationCompositeKey; |
35 | import org.thingsboard.server.dao.model.sql.RelationEntity; | 34 | import org.thingsboard.server.dao.model.sql.RelationEntity; |
36 | import org.thingsboard.server.dao.relation.RelationDao; | 35 | import org.thingsboard.server.dao.relation.RelationDao; |
37 | import org.thingsboard.server.dao.sql.JpaAbstractDaoListeningExecutorService; | 36 | import org.thingsboard.server.dao.sql.JpaAbstractDaoListeningExecutorService; |
38 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTimeDao; | 37 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTimeDao; |
38 | +import org.thingsboard.server.dao.util.SqlDao; | ||
39 | 39 | ||
40 | import javax.persistence.criteria.CriteriaBuilder; | 40 | import javax.persistence.criteria.CriteriaBuilder; |
41 | import javax.persistence.criteria.CriteriaQuery; | 41 | import javax.persistence.criteria.CriteriaQuery; |
@@ -17,11 +17,11 @@ package org.thingsboard.server.dao.sql.relation; | @@ -17,11 +17,11 @@ package org.thingsboard.server.dao.sql.relation; | ||
17 | 17 | ||
18 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 18 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
19 | import org.springframework.data.repository.CrudRepository; | 19 | import org.springframework.data.repository.CrudRepository; |
20 | -import org.thingsboard.server.dao.util.SqlDao; | 20 | +import org.springframework.transaction.annotation.Transactional; |
21 | import org.thingsboard.server.dao.model.sql.RelationCompositeKey; | 21 | import org.thingsboard.server.dao.model.sql.RelationCompositeKey; |
22 | import org.thingsboard.server.dao.model.sql.RelationEntity; | 22 | import org.thingsboard.server.dao.model.sql.RelationEntity; |
23 | +import org.thingsboard.server.dao.util.SqlDao; | ||
23 | 24 | ||
24 | -import javax.transaction.Transactional; | ||
25 | import java.util.List; | 25 | import java.util.List; |
26 | import java.util.UUID; | 26 | import java.util.UUID; |
27 | 27 | ||
@@ -51,5 +51,5 @@ public interface RelationRepository | @@ -51,5 +51,5 @@ public interface RelationRepository | ||
51 | String fromType); | 51 | String fromType); |
52 | 52 | ||
53 | @Transactional | 53 | @Transactional |
54 | - List<RelationEntity> deleteByFromIdAndFromType(UUID fromId, String fromType); | 54 | + void deleteByFromIdAndFromType(UUID fromId, String fromType); |
55 | } | 55 | } |
@@ -17,6 +17,6 @@ package org.thingsboard.server.dao.util; | @@ -17,6 +17,6 @@ package org.thingsboard.server.dao.util; | ||
17 | 17 | ||
18 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 18 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
19 | 19 | ||
20 | -@ConditionalOnProperty(prefix = "database", value = "type", havingValue = "postgres") | 20 | +@ConditionalOnProperty(prefix = "database", value = "type", havingValue = "sql") |
21 | public @interface SqlDao { | 21 | public @interface SqlDao { |
22 | } | 22 | } |
dao/src/main/resources/sql/demo-data.sql
renamed from
dao/src/main/resources/postgres/demo-data.sql
dao/src/main/resources/sql/schema.sql
renamed from
dao/src/main/resources/postgres/schema.sql
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | 17 | ||
18 | CREATE TABLE IF NOT EXISTS admin_settings ( | 18 | CREATE TABLE IF NOT EXISTS admin_settings ( |
19 | id uuid NOT NULL CONSTRAINT admin_settings_pkey PRIMARY KEY, | 19 | id uuid NOT NULL CONSTRAINT admin_settings_pkey PRIMARY KEY, |
20 | - json_value text, | 20 | + json_value varchar, |
21 | key character varying(255) | 21 | key character varying(255) |
22 | ); | 22 | ); |
23 | 23 | ||
@@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS alarm ( | @@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS alarm ( | ||
25 | id uuid NOT NULL CONSTRAINT alarm_pkey PRIMARY KEY, | 25 | id uuid NOT NULL CONSTRAINT alarm_pkey PRIMARY KEY, |
26 | ack_ts bigint, | 26 | ack_ts bigint, |
27 | clear_ts bigint, | 27 | clear_ts bigint, |
28 | - additional_info text, | 28 | + additional_info varchar, |
29 | end_ts bigint, | 29 | end_ts bigint, |
30 | originator_id uuid, | 30 | originator_id uuid, |
31 | originator_type integer, | 31 | originator_type integer, |
@@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS alarm ( | @@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS alarm ( | ||
39 | 39 | ||
40 | CREATE TABLE IF NOT EXISTS asset ( | 40 | CREATE TABLE IF NOT EXISTS asset ( |
41 | id uuid NOT NULL CONSTRAINT asset_pkey PRIMARY KEY, | 41 | id uuid NOT NULL CONSTRAINT asset_pkey PRIMARY KEY, |
42 | - additional_info text, | 42 | + additional_info varchar, |
43 | customer_id uuid, | 43 | customer_id uuid, |
44 | name character varying(255), | 44 | name character varying(255), |
45 | search_text character varying(255), | 45 | search_text character varying(255), |
@@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS component_descriptor ( | @@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS component_descriptor ( | ||
64 | id uuid NOT NULL CONSTRAINT component_descriptor_pkey PRIMARY KEY, | 64 | id uuid NOT NULL CONSTRAINT component_descriptor_pkey PRIMARY KEY, |
65 | actions character varying(255), | 65 | actions character varying(255), |
66 | clazz character varying(255), | 66 | clazz character varying(255), |
67 | - configuration_descriptor text, | 67 | + configuration_descriptor varchar, |
68 | name character varying(255), | 68 | name character varying(255), |
69 | scope character varying(255), | 69 | scope character varying(255), |
70 | search_text character varying(255), | 70 | search_text character varying(255), |
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS component_descriptor ( | @@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS component_descriptor ( | ||
73 | 73 | ||
74 | CREATE TABLE IF NOT EXISTS customer ( | 74 | CREATE TABLE IF NOT EXISTS customer ( |
75 | id uuid NOT NULL CONSTRAINT customer_pkey PRIMARY KEY, | 75 | id uuid NOT NULL CONSTRAINT customer_pkey PRIMARY KEY, |
76 | - additional_info text, | 76 | + additional_info varchar, |
77 | address character varying(255), | 77 | address character varying(255), |
78 | address2 character varying(255), | 78 | address2 character varying(255), |
79 | city character varying(255), | 79 | city character varying(255), |
@@ -89,7 +89,7 @@ CREATE TABLE IF NOT EXISTS customer ( | @@ -89,7 +89,7 @@ CREATE TABLE IF NOT EXISTS customer ( | ||
89 | 89 | ||
90 | CREATE TABLE IF NOT EXISTS dashboard ( | 90 | CREATE TABLE IF NOT EXISTS dashboard ( |
91 | id uuid NOT NULL CONSTRAINT dashboard_pkey PRIMARY KEY, | 91 | id uuid NOT NULL CONSTRAINT dashboard_pkey PRIMARY KEY, |
92 | - configuration text, | 92 | + configuration varchar, |
93 | customer_id uuid, | 93 | customer_id uuid, |
94 | search_text character varying(255), | 94 | search_text character varying(255), |
95 | tenant_id uuid, | 95 | tenant_id uuid, |
@@ -98,7 +98,7 @@ CREATE TABLE IF NOT EXISTS dashboard ( | @@ -98,7 +98,7 @@ CREATE TABLE IF NOT EXISTS dashboard ( | ||
98 | 98 | ||
99 | CREATE TABLE IF NOT EXISTS device ( | 99 | CREATE TABLE IF NOT EXISTS device ( |
100 | id uuid NOT NULL CONSTRAINT device_pkey PRIMARY KEY, | 100 | id uuid NOT NULL CONSTRAINT device_pkey PRIMARY KEY, |
101 | - additional_info text, | 101 | + additional_info varchar, |
102 | customer_id uuid, | 102 | customer_id uuid, |
103 | type character varying(255), | 103 | type character varying(255), |
104 | name character varying(255), | 104 | name character varying(255), |
@@ -116,7 +116,7 @@ CREATE TABLE IF NOT EXISTS device_credentials ( | @@ -116,7 +116,7 @@ CREATE TABLE IF NOT EXISTS device_credentials ( | ||
116 | 116 | ||
117 | CREATE TABLE IF NOT EXISTS event ( | 117 | CREATE TABLE IF NOT EXISTS event ( |
118 | id uuid NOT NULL CONSTRAINT event_pkey PRIMARY KEY, | 118 | id uuid NOT NULL CONSTRAINT event_pkey PRIMARY KEY, |
119 | - body text, | 119 | + body varchar, |
120 | entity_id uuid, | 120 | entity_id uuid, |
121 | entity_type character varying(255), | 121 | entity_type character varying(255), |
122 | event_type character varying(255), | 122 | event_type character varying(255), |
@@ -127,10 +127,10 @@ CREATE TABLE IF NOT EXISTS event ( | @@ -127,10 +127,10 @@ CREATE TABLE IF NOT EXISTS event ( | ||
127 | 127 | ||
128 | CREATE TABLE IF NOT EXISTS plugin ( | 128 | CREATE TABLE IF NOT EXISTS plugin ( |
129 | id uuid NOT NULL CONSTRAINT plugin_pkey PRIMARY KEY, | 129 | id uuid NOT NULL CONSTRAINT plugin_pkey PRIMARY KEY, |
130 | - additional_info text, | 130 | + additional_info varchar, |
131 | api_token character varying(255), | 131 | api_token character varying(255), |
132 | plugin_class character varying(255), | 132 | plugin_class character varying(255), |
133 | - configuration text, | 133 | + configuration varchar, |
134 | name character varying(255), | 134 | name character varying(255), |
135 | public_access boolean, | 135 | public_access boolean, |
136 | search_text character varying(255), | 136 | search_text character varying(255), |
@@ -145,18 +145,18 @@ CREATE TABLE IF NOT EXISTS relation ( | @@ -145,18 +145,18 @@ CREATE TABLE IF NOT EXISTS relation ( | ||
145 | to_type character varying(255), | 145 | to_type character varying(255), |
146 | relation_type_group character varying(255), | 146 | relation_type_group character varying(255), |
147 | relation_type character varying(255), | 147 | relation_type character varying(255), |
148 | - additional_info text, | 148 | + additional_info varchar, |
149 | CONSTRAINT relation_unq_key UNIQUE (from_id, from_type, relation_type_group, relation_type, to_id, to_type) | 149 | CONSTRAINT relation_unq_key UNIQUE (from_id, from_type, relation_type_group, relation_type, to_id, to_type) |
150 | ); | 150 | ); |
151 | 151 | ||
152 | CREATE TABLE IF NOT EXISTS rule ( | 152 | CREATE TABLE IF NOT EXISTS rule ( |
153 | id uuid NOT NULL CONSTRAINT rule_pkey PRIMARY KEY, | 153 | id uuid NOT NULL CONSTRAINT rule_pkey PRIMARY KEY, |
154 | - action text, | ||
155 | - additional_info text, | ||
156 | - filters text, | 154 | + action varchar, |
155 | + additional_info varchar, | ||
156 | + filters varchar, | ||
157 | name character varying(255), | 157 | name character varying(255), |
158 | plugin_token character varying(255), | 158 | plugin_token character varying(255), |
159 | - processor text, | 159 | + processor varchar, |
160 | search_text character varying(255), | 160 | search_text character varying(255), |
161 | state character varying(255), | 161 | state character varying(255), |
162 | tenant_id uuid, | 162 | tenant_id uuid, |
@@ -165,7 +165,7 @@ CREATE TABLE IF NOT EXISTS rule ( | @@ -165,7 +165,7 @@ CREATE TABLE IF NOT EXISTS rule ( | ||
165 | 165 | ||
166 | CREATE TABLE IF NOT EXISTS tb_user ( | 166 | CREATE TABLE IF NOT EXISTS tb_user ( |
167 | id uuid NOT NULL CONSTRAINT tb_user_pkey PRIMARY KEY, | 167 | id uuid NOT NULL CONSTRAINT tb_user_pkey PRIMARY KEY, |
168 | - additional_info text, | 168 | + additional_info varchar, |
169 | authority character varying(255), | 169 | authority character varying(255), |
170 | customer_id uuid, | 170 | customer_id uuid, |
171 | email character varying(255) UNIQUE, | 171 | email character varying(255) UNIQUE, |
@@ -177,7 +177,7 @@ CREATE TABLE IF NOT EXISTS tb_user ( | @@ -177,7 +177,7 @@ CREATE TABLE IF NOT EXISTS tb_user ( | ||
177 | 177 | ||
178 | CREATE TABLE IF NOT EXISTS tenant ( | 178 | CREATE TABLE IF NOT EXISTS tenant ( |
179 | id uuid NOT NULL CONSTRAINT tenant_pkey PRIMARY KEY, | 179 | id uuid NOT NULL CONSTRAINT tenant_pkey PRIMARY KEY, |
180 | - additional_info text, | 180 | + additional_info varchar, |
181 | address character varying(255), | 181 | address character varying(255), |
182 | address2 character varying(255), | 182 | address2 character varying(255), |
183 | city character varying(255), | 183 | city character varying(255), |
@@ -228,7 +228,7 @@ CREATE TABLE IF NOT EXISTS widget_type ( | @@ -228,7 +228,7 @@ CREATE TABLE IF NOT EXISTS widget_type ( | ||
228 | id uuid NOT NULL CONSTRAINT widget_type_pkey PRIMARY KEY, | 228 | id uuid NOT NULL CONSTRAINT widget_type_pkey PRIMARY KEY, |
229 | alias character varying(255), | 229 | alias character varying(255), |
230 | bundle_alias character varying(255), | 230 | bundle_alias character varying(255), |
231 | - descriptor text, | 231 | + descriptor varchar(1000000), |
232 | name character varying(255), | 232 | name character varying(255), |
233 | tenant_id uuid | 233 | tenant_id uuid |
234 | ); | 234 | ); |
@@ -236,7 +236,6 @@ CREATE TABLE IF NOT EXISTS widget_type ( | @@ -236,7 +236,6 @@ CREATE TABLE IF NOT EXISTS widget_type ( | ||
236 | CREATE TABLE IF NOT EXISTS widgets_bundle ( | 236 | CREATE TABLE IF NOT EXISTS widgets_bundle ( |
237 | id uuid NOT NULL CONSTRAINT widgets_bundle_pkey PRIMARY KEY, | 237 | id uuid NOT NULL CONSTRAINT widgets_bundle_pkey PRIMARY KEY, |
238 | alias character varying(255), | 238 | alias character varying(255), |
239 | - image bytea, | ||
240 | search_text character varying(255), | 239 | search_text character varying(255), |
241 | tenant_id uuid, | 240 | tenant_id uuid, |
242 | title character varying(255) | 241 | title character varying(255) |
dao/src/main/resources/sql/system-data.sql
renamed from
dao/src/main/resources/postgres/system-data.sql
dao/src/test/java/org/thingsboard/server/dao/CustomSqlUnit.java
renamed from
dao/src/test/java/org/thingsboard/server/dao/CustomPostgresUnit.java
@@ -19,7 +19,6 @@ import com.google.common.base.Charsets; | @@ -19,7 +19,6 @@ import com.google.common.base.Charsets; | ||
19 | import com.google.common.io.Resources; | 19 | import com.google.common.io.Resources; |
20 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
21 | import org.junit.rules.ExternalResource; | 21 | import org.junit.rules.ExternalResource; |
22 | -import ru.yandex.qatools.embed.postgresql.EmbeddedPostgres; | ||
23 | 22 | ||
24 | import java.io.IOException; | 23 | import java.io.IOException; |
25 | import java.io.InputStream; | 24 | import java.io.InputStream; |
@@ -30,58 +29,47 @@ import java.sql.SQLException; | @@ -30,58 +29,47 @@ import java.sql.SQLException; | ||
30 | import java.util.List; | 29 | import java.util.List; |
31 | import java.util.Properties; | 30 | import java.util.Properties; |
32 | 31 | ||
33 | -import static ru.yandex.qatools.embed.postgresql.distribution.Version.Main.V9_6; | ||
34 | 32 | ||
35 | /** | 33 | /** |
36 | * Created by Valerii Sosliuk on 6/24/2017. | 34 | * Created by Valerii Sosliuk on 6/24/2017. |
37 | */ | 35 | */ |
38 | @Slf4j | 36 | @Slf4j |
39 | -public class CustomPostgresUnit extends ExternalResource { | 37 | +public class CustomSqlUnit extends ExternalResource { |
40 | 38 | ||
41 | - private static final String HOST = "host"; | ||
42 | - private static final String PORT = "port"; | ||
43 | - private static final String DATABASE = "database"; | ||
44 | - private static final String USERNAME = "username"; | ||
45 | - private static final String PASSWORD = "password"; | 39 | + private final List<String> sqlFiles; |
40 | + private final String dropAllTablesSqlFile; | ||
41 | + private final String dbUrl; | ||
42 | + private final String dbUserName; | ||
43 | + private final String dbPassword; | ||
46 | 44 | ||
47 | - private List<String> sqlFiles; | ||
48 | - private Properties properties; | ||
49 | - | ||
50 | - private EmbeddedPostgres postgres; | ||
51 | - | ||
52 | - public CustomPostgresUnit(List<String> sqlFiles, String configurationFileName) { | 45 | + public CustomSqlUnit(List<String> sqlFiles, String dropAllTablesSqlFile, String configurationFileName) { |
53 | this.sqlFiles = sqlFiles; | 46 | this.sqlFiles = sqlFiles; |
54 | - this.properties = loadProperties(configurationFileName); | 47 | + this.dropAllTablesSqlFile = dropAllTablesSqlFile; |
48 | + final Properties properties = new Properties(); | ||
49 | + try (final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(configurationFileName)) { | ||
50 | + properties.load(stream); | ||
51 | + this.dbUrl = properties.getProperty("spring.datasource.url"); | ||
52 | + this.dbUserName = properties.getProperty("spring.datasource.username"); | ||
53 | + this.dbPassword = properties.getProperty("spring.datasource.password"); | ||
54 | + } catch (IOException e) { | ||
55 | + throw new RuntimeException(e.getMessage(), e); | ||
56 | + } | ||
55 | } | 57 | } |
56 | 58 | ||
57 | @Override | 59 | @Override |
58 | public void before() { | 60 | public void before() { |
59 | - postgres = new EmbeddedPostgres(V9_6); | ||
60 | - load(); | ||
61 | - } | 61 | + cleanUpDb(); |
62 | 62 | ||
63 | - @Override | ||
64 | - public void after() { | ||
65 | - postgres.stop(); | ||
66 | - } | ||
67 | - | ||
68 | - private void load() { | ||
69 | Connection conn = null; | 63 | Connection conn = null; |
70 | try { | 64 | try { |
71 | - String url = postgres.start(properties.getProperty(HOST), | ||
72 | - Integer.parseInt(properties.getProperty(PORT)), | ||
73 | - properties.getProperty(DATABASE), | ||
74 | - properties.getProperty(USERNAME), | ||
75 | - properties.getProperty(PASSWORD)); | ||
76 | - | ||
77 | - conn = DriverManager.getConnection(url); | 65 | + conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword); |
78 | for (String sqlFile : sqlFiles) { | 66 | for (String sqlFile : sqlFiles) { |
79 | URL sqlFileUrl = Resources.getResource(sqlFile); | 67 | URL sqlFileUrl = Resources.getResource(sqlFile); |
80 | String sql = Resources.toString(sqlFileUrl, Charsets.UTF_8); | 68 | String sql = Resources.toString(sqlFileUrl, Charsets.UTF_8); |
81 | conn.createStatement().execute(sql); | 69 | conn.createStatement().execute(sql); |
82 | } | 70 | } |
83 | } catch (IOException | SQLException e) { | 71 | } catch (IOException | SQLException e) { |
84 | - throw new RuntimeException("Unable to start embedded postgres. Reason: " + e.getMessage(), e); | 72 | + throw new RuntimeException("Unable to start embedded hsqldb. Reason: " + e.getMessage(), e); |
85 | } finally { | 73 | } finally { |
86 | if (conn != null) { | 74 | if (conn != null) { |
87 | try { | 75 | try { |
@@ -93,13 +81,28 @@ public class CustomPostgresUnit extends ExternalResource { | @@ -93,13 +81,28 @@ public class CustomPostgresUnit extends ExternalResource { | ||
93 | } | 81 | } |
94 | } | 82 | } |
95 | 83 | ||
96 | - private Properties loadProperties(String fileName) { | ||
97 | - final Properties properties = new Properties(); | ||
98 | - try (final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(fileName)) { | ||
99 | - properties.load(stream); | ||
100 | - return properties; | ||
101 | - } catch (IOException e) { | ||
102 | - throw new RuntimeException(e.getMessage(), e); | 84 | + @Override |
85 | + public void after() { | ||
86 | + cleanUpDb(); | ||
87 | + } | ||
88 | + | ||
89 | + private void cleanUpDb() { | ||
90 | + Connection conn = null; | ||
91 | + try { | ||
92 | + conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword); | ||
93 | + URL dropAllTableSqlFileUrl = Resources.getResource(dropAllTablesSqlFile); | ||
94 | + String dropAllTablesSql = Resources.toString(dropAllTableSqlFileUrl, Charsets.UTF_8); | ||
95 | + conn.createStatement().execute(dropAllTablesSql); | ||
96 | + } catch (IOException | SQLException e) { | ||
97 | + throw new RuntimeException("Unable to clean up embedded hsqldb. Reason: " + e.getMessage(), e); | ||
98 | + } finally { | ||
99 | + if (conn != null) { | ||
100 | + try { | ||
101 | + conn.close(); | ||
102 | + } catch (SQLException e) { | ||
103 | + log.error(e.getMessage(), e); | ||
104 | + } | ||
105 | + } | ||
103 | } | 106 | } |
104 | } | 107 | } |
105 | } | 108 | } |
@@ -24,13 +24,15 @@ import java.util.Arrays; | @@ -24,13 +24,15 @@ import java.util.Arrays; | ||
24 | 24 | ||
25 | @RunWith(ClasspathSuite.class) | 25 | @RunWith(ClasspathSuite.class) |
26 | @ClassnameFilters({ | 26 | @ClassnameFilters({ |
27 | - "org.thingsboard.server.dao.sql.*Test" | 27 | + "org.thingsboard.server.dao.sql.*AASDTest" |
28 | }) | 28 | }) |
29 | public class JpaDaoTestSuite { | 29 | public class JpaDaoTestSuite { |
30 | 30 | ||
31 | @ClassRule | 31 | @ClassRule |
32 | - public static CustomPostgresUnit postgresUnit = new CustomPostgresUnit( | ||
33 | - Arrays.asList("postgres/schema.sql", "postgres/system-data.sql"), | ||
34 | - "postgres-embedded-test.properties"); | 32 | + public static CustomSqlUnit sqlUnit = new CustomSqlUnit( |
33 | + Arrays.asList("sql/schema.sql", "sql/system-data.sql"), | ||
34 | + "sql/drop-all-tables.sql", | ||
35 | + "sql-test.properties" | ||
36 | + ); | ||
35 | 37 | ||
36 | } | 38 | } |
@@ -18,6 +18,7 @@ package org.thingsboard.server.dao; | @@ -18,6 +18,7 @@ package org.thingsboard.server.dao; | ||
18 | import com.github.springtestdbunit.bean.DatabaseConfigBean; | 18 | import com.github.springtestdbunit.bean.DatabaseConfigBean; |
19 | import com.github.springtestdbunit.bean.DatabaseDataSourceConnectionFactoryBean; | 19 | import com.github.springtestdbunit.bean.DatabaseDataSourceConnectionFactoryBean; |
20 | import org.dbunit.DatabaseUnitException; | 20 | import org.dbunit.DatabaseUnitException; |
21 | +import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; | ||
21 | import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; | 22 | import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
23 | import org.springframework.context.annotation.Bean; | 24 | import org.springframework.context.annotation.Bean; |
@@ -41,7 +42,7 @@ public class JpaDbunitTestConfig { | @@ -41,7 +42,7 @@ public class JpaDbunitTestConfig { | ||
41 | @Bean | 42 | @Bean |
42 | public DatabaseConfigBean databaseConfigBean() { | 43 | public DatabaseConfigBean databaseConfigBean() { |
43 | DatabaseConfigBean databaseConfigBean = new DatabaseConfigBean(); | 44 | DatabaseConfigBean databaseConfigBean = new DatabaseConfigBean(); |
44 | - databaseConfigBean.setDatatypeFactory(new PostgresqlDataTypeFactory()); | 45 | + databaseConfigBean.setDatatypeFactory(new HsqldbDataTypeFactory()); |
45 | return databaseConfigBean; | 46 | return databaseConfigBean; |
46 | } | 47 | } |
47 | 48 |
@@ -29,8 +29,10 @@ import java.util.Arrays; | @@ -29,8 +29,10 @@ import java.util.Arrays; | ||
29 | public class SqlDaoServiceTestSuite { | 29 | public class SqlDaoServiceTestSuite { |
30 | 30 | ||
31 | @ClassRule | 31 | @ClassRule |
32 | - public static CustomPostgresUnit postgresUnit = new CustomPostgresUnit( | ||
33 | - Arrays.asList("postgres/schema.sql", "postgres/system-data.sql", "postgres/system-test.sql"), | ||
34 | - "postgres-embedded-test.properties"); | 32 | + public static CustomSqlUnit sqlUnit = new CustomSqlUnit( |
33 | + Arrays.asList("sql/schema.sql", "sql/system-data.sql", "sql/system-test.sql"), | ||
34 | + "sql/drop-all-tables.sql", | ||
35 | + "sql-test.properties" | ||
36 | + ); | ||
35 | 37 | ||
36 | } | 38 | } |
dao/src/test/resources/postgres-embedded-test.properties
deleted
100644 → 0
1 | -database.type=postgres | 1 | + database.type=sql |
2 | 2 | ||
3 | spring.jpa.show-sql=false | 3 | spring.jpa.show-sql=false |
4 | spring.jpa.hibernate.ddl-auto=validate | 4 | spring.jpa.hibernate.ddl-auto=validate |
5 | +spring.jpa.database-platform=org.hibernate.dialect.HSQLDialect | ||
5 | 6 | ||
6 | -spring.datasource.url=jdbc:postgresql://localhost:5433/thingsboard-test | ||
7 | -spring.datasource.username=postgres | ||
8 | -spring.datasource.password=postgres | 7 | +spring.datasource.username=sa |
8 | +spring.datasource.password= | ||
9 | +spring.datasource.url=jdbc:hsqldb:file:/tmp/testDb;sql.enforce_size=false | ||
10 | +spring.datasource.driverClassName=org.hsqldb.jdbc.JDBCDriver |
1 | +TRUNCATE TABLE admin_settings; | ||
2 | +TRUNCATE TABLE alarm; | ||
3 | +TRUNCATE TABLE asset; | ||
4 | +TRUNCATE TABLE attribute_kv; | ||
5 | +TRUNCATE TABLE component_descriptor; | ||
6 | +TRUNCATE TABLE customer; | ||
7 | +TRUNCATE TABLE dashboard; | ||
8 | +TRUNCATE TABLE device; | ||
9 | +TRUNCATE TABLE device_credentials; | ||
10 | +TRUNCATE TABLE event; | ||
11 | +TRUNCATE TABLE plugin; | ||
12 | +TRUNCATE TABLE relation; | ||
13 | +TRUNCATE TABLE rule; | ||
14 | +TRUNCATE TABLE tb_user; | ||
15 | +TRUNCATE TABLE tenant; | ||
16 | +TRUNCATE TABLE ts_kv; | ||
17 | +TRUNCATE TABLE ts_kv_latest; | ||
18 | +TRUNCATE TABLE user_credentials; | ||
19 | +TRUNCATE TABLE widget_type; | ||
20 | +TRUNCATE TABLE widgets_bundle; |
dao/src/test/resources/sql/system-test.sql
renamed from
dao/src/test/resources/postgres/system-test.sql
@@ -71,6 +71,7 @@ | @@ -71,6 +71,7 @@ | ||
71 | <springfox-swagger.version>2.6.1</springfox-swagger.version> | 71 | <springfox-swagger.version>2.6.1</springfox-swagger.version> |
72 | <bouncycastle.version>1.56</bouncycastle.version> | 72 | <bouncycastle.version>1.56</bouncycastle.version> |
73 | <winsw.version>2.0.1</winsw.version> | 73 | <winsw.version>2.0.1</winsw.version> |
74 | + <hsqldb.version>2.4.0</hsqldb.version> | ||
74 | <dbunit.version>2.5.3</dbunit.version> | 75 | <dbunit.version>2.5.3</dbunit.version> |
75 | <spring-test-dbunit.version>1.2.1</spring-test-dbunit.version> | 76 | <spring-test-dbunit.version>1.2.1</spring-test-dbunit.version> |
76 | <postgresql.driver.version>9.4.1211</postgresql.driver.version> | 77 | <postgresql.driver.version>9.4.1211</postgresql.driver.version> |
@@ -747,6 +748,12 @@ | @@ -747,6 +748,12 @@ | ||
747 | <version>${bouncycastle.version}</version> | 748 | <version>${bouncycastle.version}</version> |
748 | </dependency> | 749 | </dependency> |
749 | <dependency> | 750 | <dependency> |
751 | + <groupId>org.hsqldb</groupId> | ||
752 | + <artifactId>hsqldb</artifactId> | ||
753 | + <version>${hsqldb.version}</version> | ||
754 | + <scope>test</scope> | ||
755 | + </dependency> | ||
756 | + <dependency> | ||
750 | <groupId>ru.yandex.qatools.embed</groupId> | 757 | <groupId>ru.yandex.qatools.embed</groupId> |
751 | <artifactId>postgresql-embedded</artifactId> | 758 | <artifactId>postgresql-embedded</artifactId> |
752 | <version>2.2</version> | 759 | <version>2.2</version> |