Commit e8d7675269be5dbf75f739be150aaa86db76ac22
1 parent
4b67d428
Application module postgres tests added
Showing
42 changed files
with
1535 additions
and
17 deletions
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 static org.hamcrest.Matchers.containsString; | |
19 | +import static org.hamcrest.Matchers.is; | |
20 | +import static org.hamcrest.Matchers.notNullValue; | |
21 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; | |
22 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | |
23 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | |
24 | + | |
25 | +import org.thingsboard.server.common.data.AdminSettings; | |
26 | +import org.junit.Test; | |
27 | + | |
28 | +import com.fasterxml.jackson.databind.JsonNode; | |
29 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
30 | +import com.fasterxml.jackson.databind.node.ObjectNode; | |
31 | + | |
32 | +public abstract class BaseAdminControllerTest extends AbstractControllerTest { | |
33 | + | |
34 | + @Test | |
35 | + public void testFindAdminSettingsByKey() throws Exception { | |
36 | + loginSysAdmin(); | |
37 | + doGet("/api/admin/settings/general") | |
38 | + .andExpect(status().isOk()) | |
39 | + .andExpect(content().contentType(contentType)) | |
40 | + .andExpect(jsonPath("$.id", notNullValue())) | |
41 | + .andExpect(jsonPath("$.key", is("general"))) | |
42 | + .andExpect(jsonPath("$.jsonValue.baseUrl", is("http://localhost:8080"))); | |
43 | + | |
44 | + doGet("/api/admin/settings/mail") | |
45 | + .andExpect(status().isOk()) | |
46 | + .andExpect(content().contentType(contentType)) | |
47 | + .andExpect(jsonPath("$.id", notNullValue())) | |
48 | + .andExpect(jsonPath("$.key", is("mail"))) | |
49 | + .andExpect(jsonPath("$.jsonValue.smtpProtocol", is("smtp"))) | |
50 | + .andExpect(jsonPath("$.jsonValue.smtpHost", is("localhost"))) | |
51 | + .andExpect(jsonPath("$.jsonValue.smtpPort", is("25"))); | |
52 | + | |
53 | + doGet("/api/admin/settings/unknown") | |
54 | + .andExpect(status().isNotFound()); | |
55 | + | |
56 | + } | |
57 | + | |
58 | + @Test | |
59 | + public void testSaveAdminSettings() throws Exception { | |
60 | + loginSysAdmin(); | |
61 | + AdminSettings adminSettings = doGet("/api/admin/settings/general", AdminSettings.class); | |
62 | + | |
63 | + JsonNode jsonValue = adminSettings.getJsonValue(); | |
64 | + ((ObjectNode) jsonValue).put("baseUrl", "http://myhost.org"); | |
65 | + adminSettings.setJsonValue(jsonValue); | |
66 | + | |
67 | + doPost("/api/admin/settings", adminSettings).andExpect(status().isOk()); | |
68 | + | |
69 | + doGet("/api/admin/settings/general") | |
70 | + .andExpect(status().isOk()) | |
71 | + .andExpect(content().contentType(contentType)) | |
72 | + .andExpect(jsonPath("$.jsonValue.baseUrl", is("http://myhost.org"))); | |
73 | + | |
74 | + ((ObjectNode) jsonValue).put("baseUrl", "http://localhost:8080"); | |
75 | + adminSettings.setJsonValue(jsonValue); | |
76 | + | |
77 | + doPost("/api/admin/settings", adminSettings) | |
78 | + .andExpect(status().isOk()); | |
79 | + } | |
80 | + | |
81 | + @Test | |
82 | + public void testCreateAdminSettings() throws Exception { | |
83 | + loginSysAdmin(); | |
84 | + | |
85 | + AdminSettings adminSettings = new AdminSettings(); | |
86 | + adminSettings.setKey("someKey"); | |
87 | + adminSettings.setJsonValue(new ObjectMapper().readValue("{ \"someKey\": \"someValue\" }", JsonNode.class)); | |
88 | + | |
89 | + doPost("/api/admin/settings", adminSettings) | |
90 | + .andExpect(status().isBadRequest()) | |
91 | + .andExpect(statusReason(containsString("is prohibited"))); | |
92 | + } | |
93 | + | |
94 | + @Test | |
95 | + public void testSaveAdminSettingsWithEmptyKey() throws Exception { | |
96 | + loginSysAdmin(); | |
97 | + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); | |
98 | + adminSettings.setKey(null); | |
99 | + doPost("/api/admin/settings", adminSettings) | |
100 | + .andExpect(status().isBadRequest()) | |
101 | + .andExpect(statusReason(containsString("Key should be specified"))); | |
102 | + } | |
103 | + | |
104 | + @Test | |
105 | + public void testChangeAdminSettingsKey() throws Exception { | |
106 | + loginSysAdmin(); | |
107 | + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); | |
108 | + adminSettings.setKey("newKey"); | |
109 | + doPost("/api/admin/settings", adminSettings) | |
110 | + .andExpect(status().isBadRequest()) | |
111 | + .andExpect(statusReason(containsString("is prohibited"))); | |
112 | + } | |
113 | + | |
114 | + @Test | |
115 | + public void testSaveAdminSettingsWithNewJsonStructure() throws Exception { | |
116 | + loginSysAdmin(); | |
117 | + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); | |
118 | + JsonNode json = adminSettings.getJsonValue(); | |
119 | + ((ObjectNode) json).put("newKey", "my new value"); | |
120 | + adminSettings.setJsonValue(json); | |
121 | + doPost("/api/admin/settings", adminSettings) | |
122 | + .andExpect(status().isBadRequest()) | |
123 | + .andExpect(statusReason(containsString("Provided json structure is different"))); | |
124 | + } | |
125 | + | |
126 | + @Test | |
127 | + public void testSaveAdminSettingsWithNonTextValue() throws Exception { | |
128 | + loginSysAdmin(); | |
129 | + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); | |
130 | + JsonNode json = adminSettings.getJsonValue(); | |
131 | + ((ObjectNode) json).put("timeout", 10000L); | |
132 | + adminSettings.setJsonValue(json); | |
133 | + doPost("/api/admin/settings", adminSettings) | |
134 | + .andExpect(status().isBadRequest()) | |
135 | + .andExpect(statusReason(containsString("Provided json structure can't contain non-text values"))); | |
136 | + } | |
137 | + | |
138 | + @Test | |
139 | + public void testSendTestMail() throws Exception { | |
140 | + loginSysAdmin(); | |
141 | + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); | |
142 | + doPost("/api/admin/settings/testMail", adminSettings) | |
143 | + .andExpect(status().isOk()); | |
144 | + } | |
145 | + | |
146 | +} | ... | ... |
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 static org.hamcrest.Matchers.containsString; | |
19 | +import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; | |
20 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | |
21 | + | |
22 | +import java.util.ArrayList; | |
23 | +import java.util.Collections; | |
24 | +import java.util.List; | |
25 | + | |
26 | +import org.apache.commons.lang3.RandomStringUtils; | |
27 | +import org.thingsboard.server.common.data.*; | |
28 | +import org.thingsboard.server.common.data.asset.Asset; | |
29 | +import org.thingsboard.server.common.data.asset.TenantAssetType; | |
30 | +import org.thingsboard.server.common.data.id.CustomerId; | |
31 | +import org.thingsboard.server.common.data.page.TextPageData; | |
32 | +import org.thingsboard.server.common.data.page.TextPageLink; | |
33 | +import org.thingsboard.server.common.data.security.Authority; | |
34 | +import org.thingsboard.server.dao.model.ModelConstants; | |
35 | +import org.junit.After; | |
36 | +import org.junit.Assert; | |
37 | +import org.junit.Before; | |
38 | +import org.junit.Test; | |
39 | + | |
40 | +import com.datastax.driver.core.utils.UUIDs; | |
41 | +import com.fasterxml.jackson.core.type.TypeReference; | |
42 | + | |
43 | +public abstract class BaseAssetControllerTest extends AbstractControllerTest { | |
44 | + | |
45 | + private IdComparator<Asset> idComparator = new IdComparator<>(); | |
46 | + | |
47 | + private Tenant savedTenant; | |
48 | + private User tenantAdmin; | |
49 | + | |
50 | + @Before | |
51 | + public void beforeTest() throws Exception { | |
52 | + loginSysAdmin(); | |
53 | + | |
54 | + Tenant tenant = new Tenant(); | |
55 | + tenant.setTitle("My tenant"); | |
56 | + savedTenant = doPost("/api/tenant", tenant, Tenant.class); | |
57 | + Assert.assertNotNull(savedTenant); | |
58 | + | |
59 | + tenantAdmin = new User(); | |
60 | + tenantAdmin.setAuthority(Authority.TENANT_ADMIN); | |
61 | + tenantAdmin.setTenantId(savedTenant.getId()); | |
62 | + tenantAdmin.setEmail("tenant2@thingsboard.org"); | |
63 | + tenantAdmin.setFirstName("Joe"); | |
64 | + tenantAdmin.setLastName("Downs"); | |
65 | + | |
66 | + tenantAdmin = createUserAndLogin(tenantAdmin, "testPassword1"); | |
67 | + } | |
68 | + | |
69 | + @After | |
70 | + public void afterTest() throws Exception { | |
71 | + loginSysAdmin(); | |
72 | + | |
73 | + doDelete("/api/tenant/"+savedTenant.getId().getId().toString()) | |
74 | + .andExpect(status().isOk()); | |
75 | + } | |
76 | + | |
77 | + @Test | |
78 | + public void testSaveAsset() throws Exception { | |
79 | + Asset asset = new Asset(); | |
80 | + asset.setName("My asset"); | |
81 | + asset.setType("default"); | |
82 | + Asset savedAsset = doPost("/api/asset", asset, Asset.class); | |
83 | + | |
84 | + Assert.assertNotNull(savedAsset); | |
85 | + Assert.assertNotNull(savedAsset.getId()); | |
86 | + Assert.assertTrue(savedAsset.getCreatedTime() > 0); | |
87 | + Assert.assertEquals(savedTenant.getId(), savedAsset.getTenantId()); | |
88 | + Assert.assertNotNull(savedAsset.getCustomerId()); | |
89 | + Assert.assertEquals(NULL_UUID, savedAsset.getCustomerId().getId()); | |
90 | + Assert.assertEquals(asset.getName(), savedAsset.getName()); | |
91 | + | |
92 | + savedAsset.setName("My new asset"); | |
93 | + doPost("/api/asset", savedAsset, Asset.class); | |
94 | + | |
95 | + Asset foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); | |
96 | + Assert.assertEquals(foundAsset.getName(), savedAsset.getName()); | |
97 | + } | |
98 | + | |
99 | + @Test | |
100 | + public void testFindAssetById() throws Exception { | |
101 | + Asset asset = new Asset(); | |
102 | + asset.setName("My asset"); | |
103 | + asset.setType("default"); | |
104 | + Asset savedAsset = doPost("/api/asset", asset, Asset.class); | |
105 | + Asset foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); | |
106 | + Assert.assertNotNull(foundAsset); | |
107 | + Assert.assertEquals(savedAsset, foundAsset); | |
108 | + } | |
109 | + | |
110 | + @Test | |
111 | + public void testFindAssetTypesByTenantId() throws Exception { | |
112 | + List<Asset> assets = new ArrayList<>(); | |
113 | + for (int i=0;i<3;i++) { | |
114 | + Asset asset = new Asset(); | |
115 | + asset.setName("My asset B"+i); | |
116 | + asset.setType("typeB"); | |
117 | + assets.add(doPost("/api/asset", asset, Asset.class)); | |
118 | + } | |
119 | + for (int i=0;i<7;i++) { | |
120 | + Asset asset = new Asset(); | |
121 | + asset.setName("My asset C"+i); | |
122 | + asset.setType("typeC"); | |
123 | + assets.add(doPost("/api/asset", asset, Asset.class)); | |
124 | + } | |
125 | + for (int i=0;i<9;i++) { | |
126 | + Asset asset = new Asset(); | |
127 | + asset.setName("My asset A"+i); | |
128 | + asset.setType("typeA"); | |
129 | + assets.add(doPost("/api/asset", asset, Asset.class)); | |
130 | + } | |
131 | + List<TenantAssetType> assetTypes = doGetTyped("/api/asset/types", | |
132 | + new TypeReference<List<TenantAssetType>>(){}); | |
133 | + | |
134 | + Assert.assertNotNull(assetTypes); | |
135 | + Assert.assertEquals(3, assetTypes.size()); | |
136 | + Assert.assertEquals("typeA", assetTypes.get(0).getType()); | |
137 | + Assert.assertEquals("typeB", assetTypes.get(1).getType()); | |
138 | + Assert.assertEquals("typeC", assetTypes.get(2).getType()); | |
139 | + } | |
140 | + | |
141 | + @Test | |
142 | + public void testDeleteAsset() throws Exception { | |
143 | + Asset asset = new Asset(); | |
144 | + asset.setName("My asset"); | |
145 | + asset.setType("default"); | |
146 | + Asset savedAsset = doPost("/api/asset", asset, Asset.class); | |
147 | + | |
148 | + doDelete("/api/asset/"+savedAsset.getId().getId().toString()) | |
149 | + .andExpect(status().isOk()); | |
150 | + | |
151 | + doGet("/api/asset/"+savedAsset.getId().getId().toString()) | |
152 | + .andExpect(status().isNotFound()); | |
153 | + } | |
154 | + | |
155 | + @Test | |
156 | + public void testSaveAssetWithEmptyType() throws Exception { | |
157 | + Asset asset = new Asset(); | |
158 | + asset.setName("My asset"); | |
159 | + doPost("/api/asset", asset) | |
160 | + .andExpect(status().isBadRequest()) | |
161 | + .andExpect(statusReason(containsString("Asset type should be specified"))); | |
162 | + } | |
163 | + | |
164 | + @Test | |
165 | + public void testSaveAssetWithEmptyName() throws Exception { | |
166 | + Asset asset = new Asset(); | |
167 | + asset.setType("default"); | |
168 | + doPost("/api/asset", asset) | |
169 | + .andExpect(status().isBadRequest()) | |
170 | + .andExpect(statusReason(containsString("Asset name should be specified"))); | |
171 | + } | |
172 | + | |
173 | + @Test | |
174 | + public void testAssignUnassignAssetToCustomer() throws Exception { | |
175 | + Asset asset = new Asset(); | |
176 | + asset.setName("My asset"); | |
177 | + asset.setType("default"); | |
178 | + Asset savedAsset = doPost("/api/asset", asset, Asset.class); | |
179 | + | |
180 | + Customer customer = new Customer(); | |
181 | + customer.setTitle("My customer"); | |
182 | + Customer savedCustomer = doPost("/api/customer", customer, Customer.class); | |
183 | + | |
184 | + Asset assignedAsset = doPost("/api/customer/" + savedCustomer.getId().getId().toString() | |
185 | + + "/asset/" + savedAsset.getId().getId().toString(), Asset.class); | |
186 | + Assert.assertEquals(savedCustomer.getId(), assignedAsset.getCustomerId()); | |
187 | + | |
188 | + Asset foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); | |
189 | + Assert.assertEquals(savedCustomer.getId(), foundAsset.getCustomerId()); | |
190 | + | |
191 | + Asset unassignedAsset = | |
192 | + doDelete("/api/customer/asset/" + savedAsset.getId().getId().toString(), Asset.class); | |
193 | + Assert.assertEquals(ModelConstants.NULL_UUID, unassignedAsset.getCustomerId().getId()); | |
194 | + | |
195 | + foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); | |
196 | + Assert.assertEquals(ModelConstants.NULL_UUID, foundAsset.getCustomerId().getId()); | |
197 | + } | |
198 | + | |
199 | + @Test | |
200 | + public void testAssignAssetToNonExistentCustomer() throws Exception { | |
201 | + Asset asset = new Asset(); | |
202 | + asset.setName("My asset"); | |
203 | + asset.setType("default"); | |
204 | + Asset savedAsset = doPost("/api/asset", asset, Asset.class); | |
205 | + | |
206 | + doPost("/api/customer/" + UUIDs.timeBased().toString() | |
207 | + + "/asset/" + savedAsset.getId().getId().toString()) | |
208 | + .andExpect(status().isNotFound()); | |
209 | + } | |
210 | + | |
211 | + @Test | |
212 | + public void testAssignAssetToCustomerFromDifferentTenant() throws Exception { | |
213 | + loginSysAdmin(); | |
214 | + | |
215 | + Tenant tenant2 = new Tenant(); | |
216 | + tenant2.setTitle("Different tenant"); | |
217 | + Tenant savedTenant2 = doPost("/api/tenant", tenant2, Tenant.class); | |
218 | + Assert.assertNotNull(savedTenant2); | |
219 | + | |
220 | + User tenantAdmin2 = new User(); | |
221 | + tenantAdmin2.setAuthority(Authority.TENANT_ADMIN); | |
222 | + tenantAdmin2.setTenantId(savedTenant2.getId()); | |
223 | + tenantAdmin2.setEmail("tenant3@thingsboard.org"); | |
224 | + tenantAdmin2.setFirstName("Joe"); | |
225 | + tenantAdmin2.setLastName("Downs"); | |
226 | + | |
227 | + tenantAdmin2 = createUserAndLogin(tenantAdmin2, "testPassword1"); | |
228 | + | |
229 | + Customer customer = new Customer(); | |
230 | + customer.setTitle("Different customer"); | |
231 | + Customer savedCustomer = doPost("/api/customer", customer, Customer.class); | |
232 | + | |
233 | + login(tenantAdmin.getEmail(), "testPassword1"); | |
234 | + | |
235 | + Asset asset = new Asset(); | |
236 | + asset.setName("My asset"); | |
237 | + asset.setType("default"); | |
238 | + Asset savedAsset = doPost("/api/asset", asset, Asset.class); | |
239 | + | |
240 | + doPost("/api/customer/" + savedCustomer.getId().getId().toString() | |
241 | + + "/asset/" + savedAsset.getId().getId().toString()) | |
242 | + .andExpect(status().isForbidden()); | |
243 | + | |
244 | + loginSysAdmin(); | |
245 | + | |
246 | + doDelete("/api/tenant/"+savedTenant2.getId().getId().toString()) | |
247 | + .andExpect(status().isOk()); | |
248 | + } | |
249 | + | |
250 | + @Test | |
251 | + public void testFindTenantAssets() throws Exception { | |
252 | + List<Asset> assets = new ArrayList<>(); | |
253 | + for (int i=0;i<178;i++) { | |
254 | + Asset asset = new Asset(); | |
255 | + asset.setName("Asset"+i); | |
256 | + asset.setType("default"); | |
257 | + assets.add(doPost("/api/asset", asset, Asset.class)); | |
258 | + } | |
259 | + List<Asset> loadedAssets = new ArrayList<>(); | |
260 | + TextPageLink pageLink = new TextPageLink(23); | |
261 | + TextPageData<Asset> pageData = null; | |
262 | + do { | |
263 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?", | |
264 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
265 | + loadedAssets.addAll(pageData.getData()); | |
266 | + if (pageData.hasNext()) { | |
267 | + pageLink = pageData.getNextPageLink(); | |
268 | + } | |
269 | + } while (pageData.hasNext()); | |
270 | + | |
271 | + Collections.sort(assets, idComparator); | |
272 | + Collections.sort(loadedAssets, idComparator); | |
273 | + | |
274 | + Assert.assertEquals(assets, loadedAssets); | |
275 | + } | |
276 | + | |
277 | + @Test | |
278 | + public void testFindTenantAssetsByName() throws Exception { | |
279 | + String title1 = "Asset title 1"; | |
280 | + List<Asset> assetsTitle1 = new ArrayList<>(); | |
281 | + for (int i=0;i<143;i++) { | |
282 | + Asset asset = new Asset(); | |
283 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
284 | + String name = title1+suffix; | |
285 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
286 | + asset.setName(name); | |
287 | + asset.setType("default"); | |
288 | + assetsTitle1.add(doPost("/api/asset", asset, Asset.class)); | |
289 | + } | |
290 | + String title2 = "Asset title 2"; | |
291 | + List<Asset> assetsTitle2 = new ArrayList<>(); | |
292 | + for (int i=0;i<75;i++) { | |
293 | + Asset asset = new Asset(); | |
294 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
295 | + String name = title2+suffix; | |
296 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
297 | + asset.setName(name); | |
298 | + asset.setType("default"); | |
299 | + assetsTitle2.add(doPost("/api/asset", asset, Asset.class)); | |
300 | + } | |
301 | + | |
302 | + List<Asset> loadedAssetsTitle1 = new ArrayList<>(); | |
303 | + TextPageLink pageLink = new TextPageLink(15, title1); | |
304 | + TextPageData<Asset> pageData = null; | |
305 | + do { | |
306 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?", | |
307 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
308 | + loadedAssetsTitle1.addAll(pageData.getData()); | |
309 | + if (pageData.hasNext()) { | |
310 | + pageLink = pageData.getNextPageLink(); | |
311 | + } | |
312 | + } while (pageData.hasNext()); | |
313 | + | |
314 | + Collections.sort(assetsTitle1, idComparator); | |
315 | + Collections.sort(loadedAssetsTitle1, idComparator); | |
316 | + | |
317 | + Assert.assertEquals(assetsTitle1, loadedAssetsTitle1); | |
318 | + | |
319 | + List<Asset> loadedAssetsTitle2 = new ArrayList<>(); | |
320 | + pageLink = new TextPageLink(4, title2); | |
321 | + do { | |
322 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?", | |
323 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
324 | + loadedAssetsTitle2.addAll(pageData.getData()); | |
325 | + if (pageData.hasNext()) { | |
326 | + pageLink = pageData.getNextPageLink(); | |
327 | + } | |
328 | + } while (pageData.hasNext()); | |
329 | + | |
330 | + Collections.sort(assetsTitle2, idComparator); | |
331 | + Collections.sort(loadedAssetsTitle2, idComparator); | |
332 | + | |
333 | + Assert.assertEquals(assetsTitle2, loadedAssetsTitle2); | |
334 | + | |
335 | + for (Asset asset : loadedAssetsTitle1) { | |
336 | + doDelete("/api/asset/"+asset.getId().getId().toString()) | |
337 | + .andExpect(status().isOk()); | |
338 | + } | |
339 | + | |
340 | + pageLink = new TextPageLink(4, title1); | |
341 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?", | |
342 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
343 | + Assert.assertFalse(pageData.hasNext()); | |
344 | + Assert.assertEquals(0, pageData.getData().size()); | |
345 | + | |
346 | + for (Asset asset : loadedAssetsTitle2) { | |
347 | + doDelete("/api/asset/"+asset.getId().getId().toString()) | |
348 | + .andExpect(status().isOk()); | |
349 | + } | |
350 | + | |
351 | + pageLink = new TextPageLink(4, title2); | |
352 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?", | |
353 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
354 | + Assert.assertFalse(pageData.hasNext()); | |
355 | + Assert.assertEquals(0, pageData.getData().size()); | |
356 | + } | |
357 | + | |
358 | + @Test | |
359 | + public void testFindTenantAssetsByType() throws Exception { | |
360 | + String title1 = "Asset title 1"; | |
361 | + String type1 = "typeA"; | |
362 | + List<Asset> assetsType1 = new ArrayList<>(); | |
363 | + for (int i=0;i<143;i++) { | |
364 | + Asset asset = new Asset(); | |
365 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
366 | + String name = title1+suffix; | |
367 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
368 | + asset.setName(name); | |
369 | + asset.setType(type1); | |
370 | + assetsType1.add(doPost("/api/asset", asset, Asset.class)); | |
371 | + } | |
372 | + String title2 = "Asset title 2"; | |
373 | + String type2 = "typeB"; | |
374 | + List<Asset> assetsType2 = new ArrayList<>(); | |
375 | + for (int i=0;i<75;i++) { | |
376 | + Asset asset = new Asset(); | |
377 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
378 | + String name = title2+suffix; | |
379 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
380 | + asset.setName(name); | |
381 | + asset.setType(type2); | |
382 | + assetsType2.add(doPost("/api/asset", asset, Asset.class)); | |
383 | + } | |
384 | + | |
385 | + List<Asset> loadedAssetsType1 = new ArrayList<>(); | |
386 | + TextPageLink pageLink = new TextPageLink(15); | |
387 | + TextPageData<Asset> pageData = null; | |
388 | + do { | |
389 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", | |
390 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type1); | |
391 | + loadedAssetsType1.addAll(pageData.getData()); | |
392 | + if (pageData.hasNext()) { | |
393 | + pageLink = pageData.getNextPageLink(); | |
394 | + } | |
395 | + } while (pageData.hasNext()); | |
396 | + | |
397 | + Collections.sort(assetsType1, idComparator); | |
398 | + Collections.sort(loadedAssetsType1, idComparator); | |
399 | + | |
400 | + Assert.assertEquals(assetsType1, loadedAssetsType1); | |
401 | + | |
402 | + List<Asset> loadedAssetsType2 = new ArrayList<>(); | |
403 | + pageLink = new TextPageLink(4); | |
404 | + do { | |
405 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", | |
406 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type2); | |
407 | + loadedAssetsType2.addAll(pageData.getData()); | |
408 | + if (pageData.hasNext()) { | |
409 | + pageLink = pageData.getNextPageLink(); | |
410 | + } | |
411 | + } while (pageData.hasNext()); | |
412 | + | |
413 | + Collections.sort(assetsType2, idComparator); | |
414 | + Collections.sort(loadedAssetsType2, idComparator); | |
415 | + | |
416 | + Assert.assertEquals(assetsType2, loadedAssetsType2); | |
417 | + | |
418 | + for (Asset asset : loadedAssetsType1) { | |
419 | + doDelete("/api/asset/"+asset.getId().getId().toString()) | |
420 | + .andExpect(status().isOk()); | |
421 | + } | |
422 | + | |
423 | + pageLink = new TextPageLink(4); | |
424 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", | |
425 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type1); | |
426 | + Assert.assertFalse(pageData.hasNext()); | |
427 | + Assert.assertEquals(0, pageData.getData().size()); | |
428 | + | |
429 | + for (Asset asset : loadedAssetsType2) { | |
430 | + doDelete("/api/asset/"+asset.getId().getId().toString()) | |
431 | + .andExpect(status().isOk()); | |
432 | + } | |
433 | + | |
434 | + pageLink = new TextPageLink(4); | |
435 | + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", | |
436 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type2); | |
437 | + Assert.assertFalse(pageData.hasNext()); | |
438 | + Assert.assertEquals(0, pageData.getData().size()); | |
439 | + } | |
440 | + | |
441 | + @Test | |
442 | + public void testFindCustomerAssets() throws Exception { | |
443 | + Customer customer = new Customer(); | |
444 | + customer.setTitle("Test customer"); | |
445 | + customer = doPost("/api/customer", customer, Customer.class); | |
446 | + CustomerId customerId = customer.getId(); | |
447 | + | |
448 | + List<Asset> assets = new ArrayList<>(); | |
449 | + for (int i=0;i<128;i++) { | |
450 | + Asset asset = new Asset(); | |
451 | + asset.setName("Asset"+i); | |
452 | + asset.setType("default"); | |
453 | + asset = doPost("/api/asset", asset, Asset.class); | |
454 | + assets.add(doPost("/api/customer/" + customerId.getId().toString() | |
455 | + + "/asset/" + asset.getId().getId().toString(), Asset.class)); | |
456 | + } | |
457 | + | |
458 | + List<Asset> loadedAssets = new ArrayList<>(); | |
459 | + TextPageLink pageLink = new TextPageLink(23); | |
460 | + TextPageData<Asset> pageData = null; | |
461 | + do { | |
462 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", | |
463 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
464 | + loadedAssets.addAll(pageData.getData()); | |
465 | + if (pageData.hasNext()) { | |
466 | + pageLink = pageData.getNextPageLink(); | |
467 | + } | |
468 | + } while (pageData.hasNext()); | |
469 | + | |
470 | + Collections.sort(assets, idComparator); | |
471 | + Collections.sort(loadedAssets, idComparator); | |
472 | + | |
473 | + Assert.assertEquals(assets, loadedAssets); | |
474 | + } | |
475 | + | |
476 | + @Test | |
477 | + public void testFindCustomerAssetsByName() throws Exception { | |
478 | + Customer customer = new Customer(); | |
479 | + customer.setTitle("Test customer"); | |
480 | + customer = doPost("/api/customer", customer, Customer.class); | |
481 | + CustomerId customerId = customer.getId(); | |
482 | + | |
483 | + String title1 = "Asset title 1"; | |
484 | + List<Asset> assetsTitle1 = new ArrayList<>(); | |
485 | + for (int i=0;i<125;i++) { | |
486 | + Asset asset = new Asset(); | |
487 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
488 | + String name = title1+suffix; | |
489 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
490 | + asset.setName(name); | |
491 | + asset.setType("default"); | |
492 | + asset = doPost("/api/asset", asset, Asset.class); | |
493 | + assetsTitle1.add(doPost("/api/customer/" + customerId.getId().toString() | |
494 | + + "/asset/" + asset.getId().getId().toString(), Asset.class)); | |
495 | + } | |
496 | + String title2 = "Asset title 2"; | |
497 | + List<Asset> assetsTitle2 = new ArrayList<>(); | |
498 | + for (int i=0;i<143;i++) { | |
499 | + Asset asset = new Asset(); | |
500 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
501 | + String name = title2+suffix; | |
502 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
503 | + asset.setName(name); | |
504 | + asset.setType("default"); | |
505 | + asset = doPost("/api/asset", asset, Asset.class); | |
506 | + assetsTitle2.add(doPost("/api/customer/" + customerId.getId().toString() | |
507 | + + "/asset/" + asset.getId().getId().toString(), Asset.class)); | |
508 | + } | |
509 | + | |
510 | + List<Asset> loadedAssetsTitle1 = new ArrayList<>(); | |
511 | + TextPageLink pageLink = new TextPageLink(15, title1); | |
512 | + TextPageData<Asset> pageData = null; | |
513 | + do { | |
514 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", | |
515 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
516 | + loadedAssetsTitle1.addAll(pageData.getData()); | |
517 | + if (pageData.hasNext()) { | |
518 | + pageLink = pageData.getNextPageLink(); | |
519 | + } | |
520 | + } while (pageData.hasNext()); | |
521 | + | |
522 | + Collections.sort(assetsTitle1, idComparator); | |
523 | + Collections.sort(loadedAssetsTitle1, idComparator); | |
524 | + | |
525 | + Assert.assertEquals(assetsTitle1, loadedAssetsTitle1); | |
526 | + | |
527 | + List<Asset> loadedAssetsTitle2 = new ArrayList<>(); | |
528 | + pageLink = new TextPageLink(4, title2); | |
529 | + do { | |
530 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", | |
531 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
532 | + loadedAssetsTitle2.addAll(pageData.getData()); | |
533 | + if (pageData.hasNext()) { | |
534 | + pageLink = pageData.getNextPageLink(); | |
535 | + } | |
536 | + } while (pageData.hasNext()); | |
537 | + | |
538 | + Collections.sort(assetsTitle2, idComparator); | |
539 | + Collections.sort(loadedAssetsTitle2, idComparator); | |
540 | + | |
541 | + Assert.assertEquals(assetsTitle2, loadedAssetsTitle2); | |
542 | + | |
543 | + for (Asset asset : loadedAssetsTitle1) { | |
544 | + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) | |
545 | + .andExpect(status().isOk()); | |
546 | + } | |
547 | + | |
548 | + pageLink = new TextPageLink(4, title1); | |
549 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", | |
550 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
551 | + Assert.assertFalse(pageData.hasNext()); | |
552 | + Assert.assertEquals(0, pageData.getData().size()); | |
553 | + | |
554 | + for (Asset asset : loadedAssetsTitle2) { | |
555 | + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) | |
556 | + .andExpect(status().isOk()); | |
557 | + } | |
558 | + | |
559 | + pageLink = new TextPageLink(4, title2); | |
560 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", | |
561 | + new TypeReference<TextPageData<Asset>>(){}, pageLink); | |
562 | + Assert.assertFalse(pageData.hasNext()); | |
563 | + Assert.assertEquals(0, pageData.getData().size()); | |
564 | + } | |
565 | + | |
566 | + @Test | |
567 | + public void testFindCustomerAssetsByType() throws Exception { | |
568 | + Customer customer = new Customer(); | |
569 | + customer.setTitle("Test customer"); | |
570 | + customer = doPost("/api/customer", customer, Customer.class); | |
571 | + CustomerId customerId = customer.getId(); | |
572 | + | |
573 | + String title1 = "Asset title 1"; | |
574 | + String type1 = "typeC"; | |
575 | + List<Asset> assetsType1 = new ArrayList<>(); | |
576 | + for (int i=0;i<125;i++) { | |
577 | + Asset asset = new Asset(); | |
578 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
579 | + String name = title1+suffix; | |
580 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
581 | + asset.setName(name); | |
582 | + asset.setType(type1); | |
583 | + asset = doPost("/api/asset", asset, Asset.class); | |
584 | + assetsType1.add(doPost("/api/customer/" + customerId.getId().toString() | |
585 | + + "/asset/" + asset.getId().getId().toString(), Asset.class)); | |
586 | + } | |
587 | + String title2 = "Asset title 2"; | |
588 | + String type2 = "typeD"; | |
589 | + List<Asset> assetsType2 = new ArrayList<>(); | |
590 | + for (int i=0;i<143;i++) { | |
591 | + Asset asset = new Asset(); | |
592 | + String suffix = RandomStringUtils.randomAlphanumeric(15); | |
593 | + String name = title2+suffix; | |
594 | + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); | |
595 | + asset.setName(name); | |
596 | + asset.setType(type2); | |
597 | + asset = doPost("/api/asset", asset, Asset.class); | |
598 | + assetsType2.add(doPost("/api/customer/" + customerId.getId().toString() | |
599 | + + "/asset/" + asset.getId().getId().toString(), Asset.class)); | |
600 | + } | |
601 | + | |
602 | + List<Asset> loadedAssetsType1 = new ArrayList<>(); | |
603 | + TextPageLink pageLink = new TextPageLink(15); | |
604 | + TextPageData<Asset> pageData = null; | |
605 | + do { | |
606 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", | |
607 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type1); | |
608 | + loadedAssetsType1.addAll(pageData.getData()); | |
609 | + if (pageData.hasNext()) { | |
610 | + pageLink = pageData.getNextPageLink(); | |
611 | + } | |
612 | + } while (pageData.hasNext()); | |
613 | + | |
614 | + Collections.sort(assetsType1, idComparator); | |
615 | + Collections.sort(loadedAssetsType1, idComparator); | |
616 | + | |
617 | + Assert.assertEquals(assetsType1, loadedAssetsType1); | |
618 | + | |
619 | + List<Asset> loadedAssetsType2 = new ArrayList<>(); | |
620 | + pageLink = new TextPageLink(4); | |
621 | + do { | |
622 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", | |
623 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type2); | |
624 | + loadedAssetsType2.addAll(pageData.getData()); | |
625 | + if (pageData.hasNext()) { | |
626 | + pageLink = pageData.getNextPageLink(); | |
627 | + } | |
628 | + } while (pageData.hasNext()); | |
629 | + | |
630 | + Collections.sort(assetsType2, idComparator); | |
631 | + Collections.sort(loadedAssetsType2, idComparator); | |
632 | + | |
633 | + Assert.assertEquals(assetsType2, loadedAssetsType2); | |
634 | + | |
635 | + for (Asset asset : loadedAssetsType1) { | |
636 | + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) | |
637 | + .andExpect(status().isOk()); | |
638 | + } | |
639 | + | |
640 | + pageLink = new TextPageLink(4); | |
641 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", | |
642 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type1); | |
643 | + Assert.assertFalse(pageData.hasNext()); | |
644 | + Assert.assertEquals(0, pageData.getData().size()); | |
645 | + | |
646 | + for (Asset asset : loadedAssetsType2) { | |
647 | + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) | |
648 | + .andExpect(status().isOk()); | |
649 | + } | |
650 | + | |
651 | + pageLink = new TextPageLink(4); | |
652 | + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", | |
653 | + new TypeReference<TextPageData<Asset>>(){}, pageLink, type2); | |
654 | + Assert.assertFalse(pageData.hasNext()); | |
655 | + Assert.assertEquals(0, pageData.getData().size()); | |
656 | + } | |
657 | + | |
658 | +} | ... | ... |
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 | 22 | import org.thingsboard.server.common.data.security.Authority; |
23 | 23 | import org.junit.Test; |
24 | 24 | |
25 | -public class AuthControllerTest extends AbstractControllerTest { | |
25 | +public abstract class BaseAuthControllerTest extends AbstractControllerTest { | |
26 | 26 | |
27 | 27 | @Test |
28 | 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 | 33 | |
34 | 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 | 38 | private static final int AMOUNT_OF_DEFAULT_PLUGINS_DESCRIPTORS = 5; |
39 | 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 | 35 | |
36 | 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 | 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 | 38 | |
39 | 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 | 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 | 42 | |
43 | 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 | 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 | 37 | |
38 | 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 | 42 | private IdComparator<PluginMetaData> idComparator = new IdComparator<>(); |
43 | 43 | |
... | ... | @@ -130,7 +130,7 @@ public class PluginControllerTest extends AbstractControllerTest { |
130 | 130 | |
131 | 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 | 134 | RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); |
135 | 135 | doPost("/api/rule/" + savedRule.getId().getId().toString() + "/activate").andExpect(status().isOk()); |
136 | 136 | |
... | ... | @@ -151,7 +151,7 @@ public class PluginControllerTest extends AbstractControllerTest { |
151 | 151 | |
152 | 152 | PluginMetaData savedPlugin = doPost("/api/plugin", plugin, PluginMetaData.class); |
153 | 153 | |
154 | - RuleMetaData rule = RuleControllerTest.createRuleMetaData(savedPlugin); | |
154 | + RuleMetaData rule = BaseRuleControllerTest.createRuleMetaData(savedPlugin); | |
155 | 155 | RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); |
156 | 156 | |
157 | 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 | 38 | |
39 | 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 | 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 | 31 | |
32 | 32 | import com.fasterxml.jackson.core.type.TypeReference; |
33 | 33 | |
34 | -public class TenantControllerTest extends AbstractControllerTest { | |
34 | +public class BaseTenantControllerTest extends AbstractControllerTest { | |
35 | 35 | |
36 | 36 | private IdComparator<Tenant> idComparator = new IdComparator<>(); |
37 | 37 | |
... | ... | @@ -107,7 +107,7 @@ public class TenantControllerTest extends AbstractControllerTest { |
107 | 107 | Assert.assertFalse(pageData.hasNext()); |
108 | 108 | Assert.assertEquals(1, pageData.getData().size()); |
109 | 109 | tenants.addAll(pageData.getData()); |
110 | - | |
110 | + | |
111 | 111 | for (int i=0;i<56;i++) { |
112 | 112 | Tenant tenant = new Tenant(); |
113 | 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 | 39 | import static org.hamcrest.Matchers.is; |
40 | 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 | 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 | 35 | import static org.hamcrest.Matchers.containsString; |
36 | 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 | 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 | 34 | import static org.hamcrest.Matchers.containsString; |
35 | 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 | 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 | 25 | |
26 | 26 | @RunWith(ClasspathSuite.class) |
27 | 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 | 31 | @ClassRule |
32 | 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.cassandraunit.dataset.cql.ClassPathCQLDataSet; | |
19 | +import org.junit.ClassRule; | |
20 | +import org.junit.extensions.cpsuite.ClasspathSuite; | |
21 | +import org.junit.runner.RunWith; | |
22 | +import org.thingsboard.server.dao.CustomCassandraCQLUnit; | |
23 | +import org.thingsboard.server.dao.CustomPostgresUnit; | |
24 | + | |
25 | +import java.util.Arrays; | |
26 | + | |
27 | +@RunWith(ClasspathSuite.class) | |
28 | +@ClasspathSuite.ClassnameFilters({ | |
29 | + "org.thingsboard.server.controller.sql.*SqlTest", | |
30 | + }) | |
31 | +public class ControllerSqlTestSuite { | |
32 | + | |
33 | + @ClassRule | |
34 | + public static CustomPostgresUnit postgresUnit = new CustomPostgresUnit( | |
35 | + Arrays.asList("postgres/schema.sql", "postgres/system-data.sql"), | |
36 | + "postgres-embedded-test.properties"); | |
37 | +} | ... | ... |
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 | +} | ... | ... |