From e8d7675269be5dbf75f739be150aaa86db76ac22 Mon Sep 17 00:00:00 2001 From: mp-loki Date: Thu, 29 Jun 2017 22:30:35 -0400 Subject: [PATCH] Application module postgres tests added --- .mvn/jvm.config | 2 +- .../controller/BaseAdminControllerTest.java | 146 ++++ .../controller/BaseAssetControllerTest.java | 658 ++++++++++++++++++ ...rTest.java => BaseAuthControllerTest.java} | 2 +- ...aseComponentDescriptorControllerTest.java} | 2 +- ...t.java => BaseCustomerControllerTest.java} | 2 +- ....java => BaseDashboardControllerTest.java} | 2 +- ...est.java => BaseDeviceControllerTest.java} | 2 +- ...est.java => BasePluginControllerTest.java} | 6 +- ...rTest.java => BaseRuleControllerTest.java} | 2 +- ...est.java => BaseTenantControllerTest.java} | 4 +- ...rTest.java => BaseUserControllerTest.java} | 2 +- ...java => BaseWidgetTypeControllerTest.java} | 2 +- ...a => BaseWidgetsBundleControllerTest.java} | 2 +- ...ite.java => ControllerNoSqlTestSuite.java} | 4 +- .../controller/ControllerSqlTestSuite.java | 37 + .../nosql/AdminControllerNoSqlTest.java | 26 + .../nosql/AssetControllerNoSqlTest.java | 27 + .../nosql/AuthControllerNoSqlTest.java | 26 + ...omponentDescriptorControllerNoSqlTest.java | 26 + .../nosql/CustomerControllerNoSqlTest.java | 26 + .../nosql/DashboardControllerNoSqlTest.java | 26 + .../nosql/DeviceControllerNoSqlTest.java | 26 + .../nosql/PluginControllerNoSqlTest.java | 26 + .../nosql/RuleControllerNoSqlTest.java | 26 + .../nosql/TenantControllerNoSqlTest.java | 26 + .../nosql/UserControllerNoSqlTest.java | 26 + .../nosql/WidgetTypeControllerNoSqlTest.java | 26 + .../WidgetsBundleControllerNoSqlTest.java | 26 + .../sql/AdminControllerSqlTest.java | 26 + .../sql/AssetControllerSqlTest.java | 26 + .../controller/sql/AuthControllerSqlTest.java | 26 + .../ComponentDescriptorControllerSqlTest.java | 26 + .../sql/CustomerControllerSqlTest.java | 26 + .../sql/DashboardControllerSqlTest.java | 26 + .../sql/DeviceControllerSqlTest.java | 26 + .../sql/PluginControllerSqlTest.java | 26 + .../controller/sql/RuleControllerSqlTest.java | 26 + .../sql/TenantControllerSqlTest.java | 26 + .../controller/sql/UserControllerSqlTest.java | 26 + .../sql/WidgetTypeControllerSqlTest.java | 26 + .../sql/WidgetsBundleControllerSqlTest.java | 26 + 42 files changed, 1535 insertions(+), 17 deletions(-) create mode 100644 application/src/test/java/org/thingsboard/server/controller/BaseAdminControllerTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/BaseAssetControllerTest.java rename application/src/test/java/org/thingsboard/server/controller/{AuthControllerTest.java => BaseAuthControllerTest.java} (97%) rename application/src/test/java/org/thingsboard/server/controller/{ComponentDescriptorControllerTest.java => BaseComponentDescriptorControllerTest.java} (97%) rename application/src/test/java/org/thingsboard/server/controller/{CustomerControllerTest.java => BaseCustomerControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{DashboardControllerTest.java => BaseDashboardControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{DeviceControllerTest.java => BaseDeviceControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{PluginControllerTest.java => BasePluginControllerTest.java} (97%) rename application/src/test/java/org/thingsboard/server/controller/{RuleControllerTest.java => BaseRuleControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{TenantControllerTest.java => BaseTenantControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{UserControllerTest.java => BaseUserControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{WidgetTypeControllerTest.java => BaseWidgetTypeControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{WidgetsBundleControllerTest.java => BaseWidgetsBundleControllerTest.java} (99%) rename application/src/test/java/org/thingsboard/server/controller/{ControllerTestSuite.java => ControllerNoSqlTestSuite.java} (93%) create mode 100644 application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/AdminControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/AssetControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/AuthControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/ComponentDescriptorControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/CustomerControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/DashboardControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/DeviceControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/PluginControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/RuleControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/TenantControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/UserControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/WidgetTypeControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/nosql/WidgetsBundleControllerNoSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/AdminControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/AssetControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/AuthControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/ComponentDescriptorControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/CustomerControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/DashboardControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/DeviceControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/PluginControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/RuleControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/TenantControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/UserControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/WidgetTypeControllerSqlTest.java create mode 100644 application/src/test/java/org/thingsboard/server/controller/sql/WidgetsBundleControllerSqlTest.java diff --git a/.mvn/jvm.config b/.mvn/jvm.config index 4dd7491565..16e2988be2 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1 +1 @@ --Xmx4096m -Xms1024m \ No newline at end of file +-Xmx6G -Xms1024m \ No newline at end of file diff --git a/application/src/test/java/org/thingsboard/server/controller/BaseAdminControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseAdminControllerTest.java new file mode 100644 index 0000000000..cda5f3ad9f --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/BaseAdminControllerTest.java @@ -0,0 +1,146 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.thingsboard.server.common.data.AdminSettings; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + +public abstract class BaseAdminControllerTest extends AbstractControllerTest { + + @Test + public void testFindAdminSettingsByKey() throws Exception { + loginSysAdmin(); + doGet("/api/admin/settings/general") + .andExpect(status().isOk()) + .andExpect(content().contentType(contentType)) + .andExpect(jsonPath("$.id", notNullValue())) + .andExpect(jsonPath("$.key", is("general"))) + .andExpect(jsonPath("$.jsonValue.baseUrl", is("http://localhost:8080"))); + + doGet("/api/admin/settings/mail") + .andExpect(status().isOk()) + .andExpect(content().contentType(contentType)) + .andExpect(jsonPath("$.id", notNullValue())) + .andExpect(jsonPath("$.key", is("mail"))) + .andExpect(jsonPath("$.jsonValue.smtpProtocol", is("smtp"))) + .andExpect(jsonPath("$.jsonValue.smtpHost", is("localhost"))) + .andExpect(jsonPath("$.jsonValue.smtpPort", is("25"))); + + doGet("/api/admin/settings/unknown") + .andExpect(status().isNotFound()); + + } + + @Test + public void testSaveAdminSettings() throws Exception { + loginSysAdmin(); + AdminSettings adminSettings = doGet("/api/admin/settings/general", AdminSettings.class); + + JsonNode jsonValue = adminSettings.getJsonValue(); + ((ObjectNode) jsonValue).put("baseUrl", "http://myhost.org"); + adminSettings.setJsonValue(jsonValue); + + doPost("/api/admin/settings", adminSettings).andExpect(status().isOk()); + + doGet("/api/admin/settings/general") + .andExpect(status().isOk()) + .andExpect(content().contentType(contentType)) + .andExpect(jsonPath("$.jsonValue.baseUrl", is("http://myhost.org"))); + + ((ObjectNode) jsonValue).put("baseUrl", "http://localhost:8080"); + adminSettings.setJsonValue(jsonValue); + + doPost("/api/admin/settings", adminSettings) + .andExpect(status().isOk()); + } + + @Test + public void testCreateAdminSettings() throws Exception { + loginSysAdmin(); + + AdminSettings adminSettings = new AdminSettings(); + adminSettings.setKey("someKey"); + adminSettings.setJsonValue(new ObjectMapper().readValue("{ \"someKey\": \"someValue\" }", JsonNode.class)); + + doPost("/api/admin/settings", adminSettings) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("is prohibited"))); + } + + @Test + public void testSaveAdminSettingsWithEmptyKey() throws Exception { + loginSysAdmin(); + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); + adminSettings.setKey(null); + doPost("/api/admin/settings", adminSettings) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("Key should be specified"))); + } + + @Test + public void testChangeAdminSettingsKey() throws Exception { + loginSysAdmin(); + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); + adminSettings.setKey("newKey"); + doPost("/api/admin/settings", adminSettings) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("is prohibited"))); + } + + @Test + public void testSaveAdminSettingsWithNewJsonStructure() throws Exception { + loginSysAdmin(); + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); + JsonNode json = adminSettings.getJsonValue(); + ((ObjectNode) json).put("newKey", "my new value"); + adminSettings.setJsonValue(json); + doPost("/api/admin/settings", adminSettings) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("Provided json structure is different"))); + } + + @Test + public void testSaveAdminSettingsWithNonTextValue() throws Exception { + loginSysAdmin(); + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); + JsonNode json = adminSettings.getJsonValue(); + ((ObjectNode) json).put("timeout", 10000L); + adminSettings.setJsonValue(json); + doPost("/api/admin/settings", adminSettings) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("Provided json structure can't contain non-text values"))); + } + + @Test + public void testSendTestMail() throws Exception { + loginSysAdmin(); + AdminSettings adminSettings = doGet("/api/admin/settings/mail", AdminSettings.class); + doPost("/api/admin/settings/testMail", adminSettings) + .andExpect(status().isOk()); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/controller/BaseAssetControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseAssetControllerTest.java new file mode 100644 index 0000000000..1350aaed4a --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/BaseAssetControllerTest.java @@ -0,0 +1,658 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller; + +import static org.hamcrest.Matchers.containsString; +import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.lang3.RandomStringUtils; +import org.thingsboard.server.common.data.*; +import org.thingsboard.server.common.data.asset.Asset; +import org.thingsboard.server.common.data.asset.TenantAssetType; +import org.thingsboard.server.common.data.id.CustomerId; +import org.thingsboard.server.common.data.page.TextPageData; +import org.thingsboard.server.common.data.page.TextPageLink; +import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.dao.model.ModelConstants; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.datastax.driver.core.utils.UUIDs; +import com.fasterxml.jackson.core.type.TypeReference; + +public abstract class BaseAssetControllerTest extends AbstractControllerTest { + + private IdComparator idComparator = new IdComparator<>(); + + private Tenant savedTenant; + private User tenantAdmin; + + @Before + public void beforeTest() throws Exception { + loginSysAdmin(); + + Tenant tenant = new Tenant(); + tenant.setTitle("My tenant"); + savedTenant = doPost("/api/tenant", tenant, Tenant.class); + Assert.assertNotNull(savedTenant); + + tenantAdmin = new User(); + tenantAdmin.setAuthority(Authority.TENANT_ADMIN); + tenantAdmin.setTenantId(savedTenant.getId()); + tenantAdmin.setEmail("tenant2@thingsboard.org"); + tenantAdmin.setFirstName("Joe"); + tenantAdmin.setLastName("Downs"); + + tenantAdmin = createUserAndLogin(tenantAdmin, "testPassword1"); + } + + @After + public void afterTest() throws Exception { + loginSysAdmin(); + + doDelete("/api/tenant/"+savedTenant.getId().getId().toString()) + .andExpect(status().isOk()); + } + + @Test + public void testSaveAsset() throws Exception { + Asset asset = new Asset(); + asset.setName("My asset"); + asset.setType("default"); + Asset savedAsset = doPost("/api/asset", asset, Asset.class); + + Assert.assertNotNull(savedAsset); + Assert.assertNotNull(savedAsset.getId()); + Assert.assertTrue(savedAsset.getCreatedTime() > 0); + Assert.assertEquals(savedTenant.getId(), savedAsset.getTenantId()); + Assert.assertNotNull(savedAsset.getCustomerId()); + Assert.assertEquals(NULL_UUID, savedAsset.getCustomerId().getId()); + Assert.assertEquals(asset.getName(), savedAsset.getName()); + + savedAsset.setName("My new asset"); + doPost("/api/asset", savedAsset, Asset.class); + + Asset foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); + Assert.assertEquals(foundAsset.getName(), savedAsset.getName()); + } + + @Test + public void testFindAssetById() throws Exception { + Asset asset = new Asset(); + asset.setName("My asset"); + asset.setType("default"); + Asset savedAsset = doPost("/api/asset", asset, Asset.class); + Asset foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); + Assert.assertNotNull(foundAsset); + Assert.assertEquals(savedAsset, foundAsset); + } + + @Test + public void testFindAssetTypesByTenantId() throws Exception { + List assets = new ArrayList<>(); + for (int i=0;i<3;i++) { + Asset asset = new Asset(); + asset.setName("My asset B"+i); + asset.setType("typeB"); + assets.add(doPost("/api/asset", asset, Asset.class)); + } + for (int i=0;i<7;i++) { + Asset asset = new Asset(); + asset.setName("My asset C"+i); + asset.setType("typeC"); + assets.add(doPost("/api/asset", asset, Asset.class)); + } + for (int i=0;i<9;i++) { + Asset asset = new Asset(); + asset.setName("My asset A"+i); + asset.setType("typeA"); + assets.add(doPost("/api/asset", asset, Asset.class)); + } + List assetTypes = doGetTyped("/api/asset/types", + new TypeReference>(){}); + + Assert.assertNotNull(assetTypes); + Assert.assertEquals(3, assetTypes.size()); + Assert.assertEquals("typeA", assetTypes.get(0).getType()); + Assert.assertEquals("typeB", assetTypes.get(1).getType()); + Assert.assertEquals("typeC", assetTypes.get(2).getType()); + } + + @Test + public void testDeleteAsset() throws Exception { + Asset asset = new Asset(); + asset.setName("My asset"); + asset.setType("default"); + Asset savedAsset = doPost("/api/asset", asset, Asset.class); + + doDelete("/api/asset/"+savedAsset.getId().getId().toString()) + .andExpect(status().isOk()); + + doGet("/api/asset/"+savedAsset.getId().getId().toString()) + .andExpect(status().isNotFound()); + } + + @Test + public void testSaveAssetWithEmptyType() throws Exception { + Asset asset = new Asset(); + asset.setName("My asset"); + doPost("/api/asset", asset) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("Asset type should be specified"))); + } + + @Test + public void testSaveAssetWithEmptyName() throws Exception { + Asset asset = new Asset(); + asset.setType("default"); + doPost("/api/asset", asset) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("Asset name should be specified"))); + } + + @Test + public void testAssignUnassignAssetToCustomer() throws Exception { + Asset asset = new Asset(); + asset.setName("My asset"); + asset.setType("default"); + Asset savedAsset = doPost("/api/asset", asset, Asset.class); + + Customer customer = new Customer(); + customer.setTitle("My customer"); + Customer savedCustomer = doPost("/api/customer", customer, Customer.class); + + Asset assignedAsset = doPost("/api/customer/" + savedCustomer.getId().getId().toString() + + "/asset/" + savedAsset.getId().getId().toString(), Asset.class); + Assert.assertEquals(savedCustomer.getId(), assignedAsset.getCustomerId()); + + Asset foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); + Assert.assertEquals(savedCustomer.getId(), foundAsset.getCustomerId()); + + Asset unassignedAsset = + doDelete("/api/customer/asset/" + savedAsset.getId().getId().toString(), Asset.class); + Assert.assertEquals(ModelConstants.NULL_UUID, unassignedAsset.getCustomerId().getId()); + + foundAsset = doGet("/api/asset/" + savedAsset.getId().getId().toString(), Asset.class); + Assert.assertEquals(ModelConstants.NULL_UUID, foundAsset.getCustomerId().getId()); + } + + @Test + public void testAssignAssetToNonExistentCustomer() throws Exception { + Asset asset = new Asset(); + asset.setName("My asset"); + asset.setType("default"); + Asset savedAsset = doPost("/api/asset", asset, Asset.class); + + doPost("/api/customer/" + UUIDs.timeBased().toString() + + "/asset/" + savedAsset.getId().getId().toString()) + .andExpect(status().isNotFound()); + } + + @Test + public void testAssignAssetToCustomerFromDifferentTenant() throws Exception { + loginSysAdmin(); + + Tenant tenant2 = new Tenant(); + tenant2.setTitle("Different tenant"); + Tenant savedTenant2 = doPost("/api/tenant", tenant2, Tenant.class); + Assert.assertNotNull(savedTenant2); + + User tenantAdmin2 = new User(); + tenantAdmin2.setAuthority(Authority.TENANT_ADMIN); + tenantAdmin2.setTenantId(savedTenant2.getId()); + tenantAdmin2.setEmail("tenant3@thingsboard.org"); + tenantAdmin2.setFirstName("Joe"); + tenantAdmin2.setLastName("Downs"); + + tenantAdmin2 = createUserAndLogin(tenantAdmin2, "testPassword1"); + + Customer customer = new Customer(); + customer.setTitle("Different customer"); + Customer savedCustomer = doPost("/api/customer", customer, Customer.class); + + login(tenantAdmin.getEmail(), "testPassword1"); + + Asset asset = new Asset(); + asset.setName("My asset"); + asset.setType("default"); + Asset savedAsset = doPost("/api/asset", asset, Asset.class); + + doPost("/api/customer/" + savedCustomer.getId().getId().toString() + + "/asset/" + savedAsset.getId().getId().toString()) + .andExpect(status().isForbidden()); + + loginSysAdmin(); + + doDelete("/api/tenant/"+savedTenant2.getId().getId().toString()) + .andExpect(status().isOk()); + } + + @Test + public void testFindTenantAssets() throws Exception { + List assets = new ArrayList<>(); + for (int i=0;i<178;i++) { + Asset asset = new Asset(); + asset.setName("Asset"+i); + asset.setType("default"); + assets.add(doPost("/api/asset", asset, Asset.class)); + } + List loadedAssets = new ArrayList<>(); + TextPageLink pageLink = new TextPageLink(23); + TextPageData pageData = null; + do { + pageData = doGetTypedWithPageLink("/api/tenant/assets?", + new TypeReference>(){}, pageLink); + loadedAssets.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assets, idComparator); + Collections.sort(loadedAssets, idComparator); + + Assert.assertEquals(assets, loadedAssets); + } + + @Test + public void testFindTenantAssetsByName() throws Exception { + String title1 = "Asset title 1"; + List assetsTitle1 = new ArrayList<>(); + for (int i=0;i<143;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title1+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType("default"); + assetsTitle1.add(doPost("/api/asset", asset, Asset.class)); + } + String title2 = "Asset title 2"; + List assetsTitle2 = new ArrayList<>(); + for (int i=0;i<75;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title2+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType("default"); + assetsTitle2.add(doPost("/api/asset", asset, Asset.class)); + } + + List loadedAssetsTitle1 = new ArrayList<>(); + TextPageLink pageLink = new TextPageLink(15, title1); + TextPageData pageData = null; + do { + pageData = doGetTypedWithPageLink("/api/tenant/assets?", + new TypeReference>(){}, pageLink); + loadedAssetsTitle1.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsTitle1, idComparator); + Collections.sort(loadedAssetsTitle1, idComparator); + + Assert.assertEquals(assetsTitle1, loadedAssetsTitle1); + + List loadedAssetsTitle2 = new ArrayList<>(); + pageLink = new TextPageLink(4, title2); + do { + pageData = doGetTypedWithPageLink("/api/tenant/assets?", + new TypeReference>(){}, pageLink); + loadedAssetsTitle2.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsTitle2, idComparator); + Collections.sort(loadedAssetsTitle2, idComparator); + + Assert.assertEquals(assetsTitle2, loadedAssetsTitle2); + + for (Asset asset : loadedAssetsTitle1) { + doDelete("/api/asset/"+asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4, title1); + pageData = doGetTypedWithPageLink("/api/tenant/assets?", + new TypeReference>(){}, pageLink); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + + for (Asset asset : loadedAssetsTitle2) { + doDelete("/api/asset/"+asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4, title2); + pageData = doGetTypedWithPageLink("/api/tenant/assets?", + new TypeReference>(){}, pageLink); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + } + + @Test + public void testFindTenantAssetsByType() throws Exception { + String title1 = "Asset title 1"; + String type1 = "typeA"; + List assetsType1 = new ArrayList<>(); + for (int i=0;i<143;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title1+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType(type1); + assetsType1.add(doPost("/api/asset", asset, Asset.class)); + } + String title2 = "Asset title 2"; + String type2 = "typeB"; + List assetsType2 = new ArrayList<>(); + for (int i=0;i<75;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title2+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType(type2); + assetsType2.add(doPost("/api/asset", asset, Asset.class)); + } + + List loadedAssetsType1 = new ArrayList<>(); + TextPageLink pageLink = new TextPageLink(15); + TextPageData pageData = null; + do { + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", + new TypeReference>(){}, pageLink, type1); + loadedAssetsType1.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsType1, idComparator); + Collections.sort(loadedAssetsType1, idComparator); + + Assert.assertEquals(assetsType1, loadedAssetsType1); + + List loadedAssetsType2 = new ArrayList<>(); + pageLink = new TextPageLink(4); + do { + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", + new TypeReference>(){}, pageLink, type2); + loadedAssetsType2.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsType2, idComparator); + Collections.sort(loadedAssetsType2, idComparator); + + Assert.assertEquals(assetsType2, loadedAssetsType2); + + for (Asset asset : loadedAssetsType1) { + doDelete("/api/asset/"+asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4); + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", + new TypeReference>(){}, pageLink, type1); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + + for (Asset asset : loadedAssetsType2) { + doDelete("/api/asset/"+asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4); + pageData = doGetTypedWithPageLink("/api/tenant/assets?type={type}&", + new TypeReference>(){}, pageLink, type2); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + } + + @Test + public void testFindCustomerAssets() throws Exception { + Customer customer = new Customer(); + customer.setTitle("Test customer"); + customer = doPost("/api/customer", customer, Customer.class); + CustomerId customerId = customer.getId(); + + List assets = new ArrayList<>(); + for (int i=0;i<128;i++) { + Asset asset = new Asset(); + asset.setName("Asset"+i); + asset.setType("default"); + asset = doPost("/api/asset", asset, Asset.class); + assets.add(doPost("/api/customer/" + customerId.getId().toString() + + "/asset/" + asset.getId().getId().toString(), Asset.class)); + } + + List loadedAssets = new ArrayList<>(); + TextPageLink pageLink = new TextPageLink(23); + TextPageData pageData = null; + do { + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", + new TypeReference>(){}, pageLink); + loadedAssets.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assets, idComparator); + Collections.sort(loadedAssets, idComparator); + + Assert.assertEquals(assets, loadedAssets); + } + + @Test + public void testFindCustomerAssetsByName() throws Exception { + Customer customer = new Customer(); + customer.setTitle("Test customer"); + customer = doPost("/api/customer", customer, Customer.class); + CustomerId customerId = customer.getId(); + + String title1 = "Asset title 1"; + List assetsTitle1 = new ArrayList<>(); + for (int i=0;i<125;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title1+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType("default"); + asset = doPost("/api/asset", asset, Asset.class); + assetsTitle1.add(doPost("/api/customer/" + customerId.getId().toString() + + "/asset/" + asset.getId().getId().toString(), Asset.class)); + } + String title2 = "Asset title 2"; + List assetsTitle2 = new ArrayList<>(); + for (int i=0;i<143;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title2+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType("default"); + asset = doPost("/api/asset", asset, Asset.class); + assetsTitle2.add(doPost("/api/customer/" + customerId.getId().toString() + + "/asset/" + asset.getId().getId().toString(), Asset.class)); + } + + List loadedAssetsTitle1 = new ArrayList<>(); + TextPageLink pageLink = new TextPageLink(15, title1); + TextPageData pageData = null; + do { + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", + new TypeReference>(){}, pageLink); + loadedAssetsTitle1.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsTitle1, idComparator); + Collections.sort(loadedAssetsTitle1, idComparator); + + Assert.assertEquals(assetsTitle1, loadedAssetsTitle1); + + List loadedAssetsTitle2 = new ArrayList<>(); + pageLink = new TextPageLink(4, title2); + do { + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", + new TypeReference>(){}, pageLink); + loadedAssetsTitle2.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsTitle2, idComparator); + Collections.sort(loadedAssetsTitle2, idComparator); + + Assert.assertEquals(assetsTitle2, loadedAssetsTitle2); + + for (Asset asset : loadedAssetsTitle1) { + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4, title1); + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", + new TypeReference>(){}, pageLink); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + + for (Asset asset : loadedAssetsTitle2) { + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4, title2); + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?", + new TypeReference>(){}, pageLink); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + } + + @Test + public void testFindCustomerAssetsByType() throws Exception { + Customer customer = new Customer(); + customer.setTitle("Test customer"); + customer = doPost("/api/customer", customer, Customer.class); + CustomerId customerId = customer.getId(); + + String title1 = "Asset title 1"; + String type1 = "typeC"; + List assetsType1 = new ArrayList<>(); + for (int i=0;i<125;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title1+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType(type1); + asset = doPost("/api/asset", asset, Asset.class); + assetsType1.add(doPost("/api/customer/" + customerId.getId().toString() + + "/asset/" + asset.getId().getId().toString(), Asset.class)); + } + String title2 = "Asset title 2"; + String type2 = "typeD"; + List assetsType2 = new ArrayList<>(); + for (int i=0;i<143;i++) { + Asset asset = new Asset(); + String suffix = RandomStringUtils.randomAlphanumeric(15); + String name = title2+suffix; + name = i % 2 == 0 ? name.toLowerCase() : name.toUpperCase(); + asset.setName(name); + asset.setType(type2); + asset = doPost("/api/asset", asset, Asset.class); + assetsType2.add(doPost("/api/customer/" + customerId.getId().toString() + + "/asset/" + asset.getId().getId().toString(), Asset.class)); + } + + List loadedAssetsType1 = new ArrayList<>(); + TextPageLink pageLink = new TextPageLink(15); + TextPageData pageData = null; + do { + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", + new TypeReference>(){}, pageLink, type1); + loadedAssetsType1.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsType1, idComparator); + Collections.sort(loadedAssetsType1, idComparator); + + Assert.assertEquals(assetsType1, loadedAssetsType1); + + List loadedAssetsType2 = new ArrayList<>(); + pageLink = new TextPageLink(4); + do { + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", + new TypeReference>(){}, pageLink, type2); + loadedAssetsType2.addAll(pageData.getData()); + if (pageData.hasNext()) { + pageLink = pageData.getNextPageLink(); + } + } while (pageData.hasNext()); + + Collections.sort(assetsType2, idComparator); + Collections.sort(loadedAssetsType2, idComparator); + + Assert.assertEquals(assetsType2, loadedAssetsType2); + + for (Asset asset : loadedAssetsType1) { + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4); + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", + new TypeReference>(){}, pageLink, type1); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + + for (Asset asset : loadedAssetsType2) { + doDelete("/api/customer/asset/" + asset.getId().getId().toString()) + .andExpect(status().isOk()); + } + + pageLink = new TextPageLink(4); + pageData = doGetTypedWithPageLink("/api/customer/" + customerId.getId().toString() + "/assets?type={type}&", + new TypeReference>(){}, pageLink, type2); + Assert.assertFalse(pageData.hasNext()); + Assert.assertEquals(0, pageData.getData().size()); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseAuthControllerTest.java similarity index 97% rename from application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseAuthControllerTest.java index fad9e54039..ba7f90dc64 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseAuthControllerTest.java @@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import org.thingsboard.server.common.data.security.Authority; import org.junit.Test; -public class AuthControllerTest extends AbstractControllerTest { +public abstract class BaseAuthControllerTest extends AbstractControllerTest { @Test public void testGetUser() throws Exception { diff --git a/application/src/test/java/org/thingsboard/server/controller/ComponentDescriptorControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseComponentDescriptorControllerTest.java similarity index 97% rename from application/src/test/java/org/thingsboard/server/controller/ComponentDescriptorControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseComponentDescriptorControllerTest.java index 0cf7c1f446..175c1387f1 100644 --- a/application/src/test/java/org/thingsboard/server/controller/ComponentDescriptorControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseComponentDescriptorControllerTest.java @@ -33,7 +33,7 @@ import java.util.List; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -public class ComponentDescriptorControllerTest extends AbstractControllerTest { +public abstract class BaseComponentDescriptorControllerTest extends AbstractControllerTest { private static final int AMOUNT_OF_DEFAULT_PLUGINS_DESCRIPTORS = 5; private Tenant savedTenant; diff --git a/application/src/test/java/org/thingsboard/server/controller/CustomerControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseCustomerControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/CustomerControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseCustomerControllerTest.java index b1076e0413..f4ed22898e 100644 --- a/application/src/test/java/org/thingsboard/server/controller/CustomerControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseCustomerControllerTest.java @@ -35,7 +35,7 @@ import org.junit.Test; import com.fasterxml.jackson.core.type.TypeReference; -public class CustomerControllerTest extends AbstractControllerTest { +public abstract class BaseCustomerControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/DashboardControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseDashboardControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/DashboardControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseDashboardControllerTest.java index dda68a64ef..bb064116f1 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DashboardControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseDashboardControllerTest.java @@ -38,7 +38,7 @@ import org.junit.Test; import com.fasterxml.jackson.core.type.TypeReference; -public class DashboardControllerTest extends AbstractControllerTest { +public abstract class BaseDashboardControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseDeviceControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseDeviceControllerTest.java index 26eaa5dbb7..7a742aa462 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseDeviceControllerTest.java @@ -42,7 +42,7 @@ import org.junit.Test; import com.fasterxml.jackson.core.type.TypeReference; -public class DeviceControllerTest extends AbstractControllerTest { +public abstract class BaseDeviceControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/PluginControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BasePluginControllerTest.java similarity index 97% rename from application/src/test/java/org/thingsboard/server/controller/PluginControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BasePluginControllerTest.java index 65f9840cb9..6933c5eb13 100644 --- a/application/src/test/java/org/thingsboard/server/controller/PluginControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BasePluginControllerTest.java @@ -37,7 +37,7 @@ import java.util.stream.Collectors; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -public class PluginControllerTest extends AbstractControllerTest { +public abstract class BasePluginControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); @@ -130,7 +130,7 @@ public class PluginControllerTest extends AbstractControllerTest { doPost("/api/plugin/" + savedPlugin.getId().getId().toString() + "/activate").andExpect(status().isOk()); - RuleMetaData rule = RuleControllerTest.createRuleMetaData(savedPlugin); + RuleMetaData rule = BaseRuleControllerTest.createRuleMetaData(savedPlugin); RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); doPost("/api/rule/" + savedRule.getId().getId().toString() + "/activate").andExpect(status().isOk()); @@ -151,7 +151,7 @@ public class PluginControllerTest extends AbstractControllerTest { PluginMetaData savedPlugin = doPost("/api/plugin", plugin, PluginMetaData.class); - RuleMetaData rule = RuleControllerTest.createRuleMetaData(savedPlugin); + RuleMetaData rule = BaseRuleControllerTest.createRuleMetaData(savedPlugin); RuleMetaData savedRule = doPost("/api/rule", rule, RuleMetaData.class); doDelete("/api/plugin/" + savedPlugin.getId().getId()).andExpect(status().isBadRequest()); diff --git a/application/src/test/java/org/thingsboard/server/controller/RuleControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseRuleControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/RuleControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseRuleControllerTest.java index 8a52216e99..bb4cc4994a 100644 --- a/application/src/test/java/org/thingsboard/server/controller/RuleControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseRuleControllerTest.java @@ -38,7 +38,7 @@ import java.util.stream.Collectors; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -public class RuleControllerTest extends AbstractControllerTest { +public abstract class BaseRuleControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/TenantControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseTenantControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/TenantControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseTenantControllerTest.java index dc4a4228f3..35ed1de643 100644 --- a/application/src/test/java/org/thingsboard/server/controller/TenantControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseTenantControllerTest.java @@ -31,7 +31,7 @@ import org.junit.Test; import com.fasterxml.jackson.core.type.TypeReference; -public class TenantControllerTest extends AbstractControllerTest { +public class BaseTenantControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); @@ -107,7 +107,7 @@ public class TenantControllerTest extends AbstractControllerTest { Assert.assertFalse(pageData.hasNext()); Assert.assertEquals(1, pageData.getData().size()); tenants.addAll(pageData.getData()); - + for (int i=0;i<56;i++) { Tenant tenant = new Tenant(); tenant.setTitle("Tenant"+i); diff --git a/application/src/test/java/org/thingsboard/server/controller/UserControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/UserControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java index d57871bba9..8dac038772 100644 --- a/application/src/test/java/org/thingsboard/server/controller/UserControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; -public class UserControllerTest extends AbstractControllerTest { +public abstract class BaseUserControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/WidgetTypeControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseWidgetTypeControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/WidgetTypeControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseWidgetTypeControllerTest.java index fbeaa8f826..08720e2dce 100644 --- a/application/src/test/java/org/thingsboard/server/controller/WidgetTypeControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseWidgetTypeControllerTest.java @@ -35,7 +35,7 @@ import java.util.List; import static org.hamcrest.Matchers.containsString; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -public class WidgetTypeControllerTest extends AbstractControllerTest { +public abstract class BaseWidgetTypeControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseWidgetsBundleControllerTest.java similarity index 99% rename from application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java rename to application/src/test/java/org/thingsboard/server/controller/BaseWidgetsBundleControllerTest.java index f8e89db52f..5a9a2bf114 100644 --- a/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseWidgetsBundleControllerTest.java @@ -34,7 +34,7 @@ import java.util.List; import static org.hamcrest.Matchers.containsString; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -public class WidgetsBundleControllerTest extends AbstractControllerTest { +public abstract class BaseWidgetsBundleControllerTest extends AbstractControllerTest { private IdComparator idComparator = new IdComparator<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/ControllerTestSuite.java b/application/src/test/java/org/thingsboard/server/controller/ControllerNoSqlTestSuite.java similarity index 93% rename from application/src/test/java/org/thingsboard/server/controller/ControllerTestSuite.java rename to application/src/test/java/org/thingsboard/server/controller/ControllerNoSqlTestSuite.java index 84e9ecdb33..b773eab87c 100644 --- a/application/src/test/java/org/thingsboard/server/controller/ControllerTestSuite.java +++ b/application/src/test/java/org/thingsboard/server/controller/ControllerNoSqlTestSuite.java @@ -25,8 +25,8 @@ import java.util.Arrays; @RunWith(ClasspathSuite.class) @ClasspathSuite.ClassnameFilters({ - "org.thingsboard.server.controller.*Test"}) -public class ControllerTestSuite { + "org.thingsboard.server.controller.nosql.*Test"}) +public class ControllerNoSqlTestSuite { @ClassRule public static CustomCassandraCQLUnit cassandraUnit = diff --git a/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java b/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java new file mode 100644 index 0000000000..b49a0df04a --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java @@ -0,0 +1,37 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller; + +import org.cassandraunit.dataset.cql.ClassPathCQLDataSet; +import org.junit.ClassRule; +import org.junit.extensions.cpsuite.ClasspathSuite; +import org.junit.runner.RunWith; +import org.thingsboard.server.dao.CustomCassandraCQLUnit; +import org.thingsboard.server.dao.CustomPostgresUnit; + +import java.util.Arrays; + +@RunWith(ClasspathSuite.class) +@ClasspathSuite.ClassnameFilters({ + "org.thingsboard.server.controller.sql.*SqlTest", + }) +public class ControllerSqlTestSuite { + + @ClassRule + public static CustomPostgresUnit postgresUnit = new CustomPostgresUnit( + Arrays.asList("postgres/schema.sql", "postgres/system-data.sql"), + "postgres-embedded-test.properties"); +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/AdminControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/AdminControllerNoSqlTest.java new file mode 100644 index 0000000000..6ec28e7ccd --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/AdminControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseAdminControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class AdminControllerNoSqlTest extends BaseAdminControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/AssetControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/AssetControllerNoSqlTest.java new file mode 100644 index 0000000000..a4bd152f07 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/AssetControllerNoSqlTest.java @@ -0,0 +1,27 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseAssetControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; +import org.thingsboard.server.dao.util.NoSqlDao; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class AssetControllerNoSqlTest extends BaseAssetControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/AuthControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/AuthControllerNoSqlTest.java new file mode 100644 index 0000000000..4896d22aad --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/AuthControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseAuthControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class AuthControllerNoSqlTest extends BaseAuthControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/ComponentDescriptorControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/ComponentDescriptorControllerNoSqlTest.java new file mode 100644 index 0000000000..f3aa3e8d95 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/ComponentDescriptorControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseComponentDescriptorControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class ComponentDescriptorControllerNoSqlTest extends BaseComponentDescriptorControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/CustomerControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/CustomerControllerNoSqlTest.java new file mode 100644 index 0000000000..2fa306797d --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/CustomerControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseCustomerControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class CustomerControllerNoSqlTest extends BaseCustomerControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/DashboardControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/DashboardControllerNoSqlTest.java new file mode 100644 index 0000000000..2a7af40c03 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/DashboardControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseDashboardControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class DashboardControllerNoSqlTest extends BaseDashboardControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/DeviceControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/DeviceControllerNoSqlTest.java new file mode 100644 index 0000000000..47f1c9e376 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/DeviceControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseDeviceControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class DeviceControllerNoSqlTest extends BaseDeviceControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/PluginControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/PluginControllerNoSqlTest.java new file mode 100644 index 0000000000..c25eca170d --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/PluginControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BasePluginControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class PluginControllerNoSqlTest extends BasePluginControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/RuleControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/RuleControllerNoSqlTest.java new file mode 100644 index 0000000000..3bf64fbe54 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/RuleControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseRuleControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class RuleControllerNoSqlTest extends BaseRuleControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/TenantControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/TenantControllerNoSqlTest.java new file mode 100644 index 0000000000..7cb34d3117 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/TenantControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseTenantControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class TenantControllerNoSqlTest extends BaseTenantControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/UserControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/UserControllerNoSqlTest.java new file mode 100644 index 0000000000..6540347f52 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/UserControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseUserControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class UserControllerNoSqlTest extends BaseUserControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/WidgetTypeControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/WidgetTypeControllerNoSqlTest.java new file mode 100644 index 0000000000..852f453af1 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/WidgetTypeControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseWidgetTypeControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class WidgetTypeControllerNoSqlTest extends BaseWidgetTypeControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/nosql/WidgetsBundleControllerNoSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/nosql/WidgetsBundleControllerNoSqlTest.java new file mode 100644 index 0000000000..02b4c07639 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/nosql/WidgetsBundleControllerNoSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.nosql; + +import org.thingsboard.server.controller.BaseWidgetsBundleControllerTest; +import org.thingsboard.server.dao.service.DaoNoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoNoSqlTest +public class WidgetsBundleControllerNoSqlTest extends BaseWidgetsBundleControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/AdminControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/AdminControllerSqlTest.java new file mode 100644 index 0000000000..2491c32a1b --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/AdminControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseAdminControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class AdminControllerSqlTest extends BaseAdminControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/AssetControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/AssetControllerSqlTest.java new file mode 100644 index 0000000000..519cc382f2 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/AssetControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseAssetControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class AssetControllerSqlTest extends BaseAssetControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/AuthControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/AuthControllerSqlTest.java new file mode 100644 index 0000000000..cb2b1f0346 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/AuthControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseAuthControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class AuthControllerSqlTest extends BaseAuthControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/ComponentDescriptorControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/ComponentDescriptorControllerSqlTest.java new file mode 100644 index 0000000000..d96b3dd764 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/ComponentDescriptorControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseComponentDescriptorControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class ComponentDescriptorControllerSqlTest extends BaseComponentDescriptorControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/CustomerControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/CustomerControllerSqlTest.java new file mode 100644 index 0000000000..8d3ba4906a --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/CustomerControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseCustomerControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class CustomerControllerSqlTest extends BaseCustomerControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/DashboardControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/DashboardControllerSqlTest.java new file mode 100644 index 0000000000..7ce48c747f --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/DashboardControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseDashboardControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class DashboardControllerSqlTest extends BaseDashboardControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/DeviceControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/DeviceControllerSqlTest.java new file mode 100644 index 0000000000..8505e642d3 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/DeviceControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseDeviceControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class DeviceControllerSqlTest extends BaseDeviceControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/PluginControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/PluginControllerSqlTest.java new file mode 100644 index 0000000000..3d750c596c --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/PluginControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BasePluginControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class PluginControllerSqlTest extends BasePluginControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/RuleControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/RuleControllerSqlTest.java new file mode 100644 index 0000000000..d70d55042e --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/RuleControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseRuleControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class RuleControllerSqlTest extends BaseRuleControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/TenantControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/TenantControllerSqlTest.java new file mode 100644 index 0000000000..582dc610fd --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/TenantControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseTenantControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class TenantControllerSqlTest extends BaseTenantControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/UserControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/UserControllerSqlTest.java new file mode 100644 index 0000000000..9b7fc3bee7 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/UserControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseUserControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class UserControllerSqlTest extends BaseUserControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/WidgetTypeControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/WidgetTypeControllerSqlTest.java new file mode 100644 index 0000000000..db0cd3ac0b --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/WidgetTypeControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseWidgetTypeControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class WidgetTypeControllerSqlTest extends BaseWidgetTypeControllerTest { +} diff --git a/application/src/test/java/org/thingsboard/server/controller/sql/WidgetsBundleControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/sql/WidgetsBundleControllerSqlTest.java new file mode 100644 index 0000000000..7e2e48137d --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/sql/WidgetsBundleControllerSqlTest.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller.sql; + +import org.thingsboard.server.controller.BaseWidgetsBundleControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; + +/** + * Created by Valerii Sosliuk on 6/28/2017. + */ +@DaoSqlTest +public class WidgetsBundleControllerSqlTest extends BaseWidgetsBundleControllerTest { +}