use of org.thingsboard.server.common.data.plugin.PluginMetaData in project thingsboard by thingsboard.
the class JpaBasePluginDaoTest method testFindByTenantIdAndPageLink.
@Test
@DatabaseSetup("classpath:dbunit/empty_dataset.xml")
public void testFindByTenantIdAndPageLink() {
UUID tenantId1 = UUIDs.timeBased();
UUID tenantId2 = UUIDs.timeBased();
createPluginsTwoTenants(tenantId1, tenantId2, "plugin_");
List<PluginMetaData> rules1 = pluginDao.findByTenantIdAndPageLink(new TenantId(tenantId1), new TextPageLink(20, "plugin_"));
assertEquals(20, rules1.size());
List<PluginMetaData> rules2 = pluginDao.findByTenantIdAndPageLink(new TenantId(tenantId1), new TextPageLink(20, "plugin_", rules1.get(19).getId().getId(), null));
assertEquals(10, rules2.size());
List<PluginMetaData> rules3 = pluginDao.findByTenantIdAndPageLink(new TenantId(tenantId1), new TextPageLink(20, "plugin_", rules2.get(9).getId().getId(), null));
assertEquals(0, rules3.size());
}
use of org.thingsboard.server.common.data.plugin.PluginMetaData in project thingsboard by thingsboard.
the class JpaBasePluginDaoTest method testFindAllTenantRulesByTenantId.
@Test
@DatabaseSetup(value = "classpath:dbunit/empty_dataset.xml")
public void testFindAllTenantRulesByTenantId() {
UUID tenantId1 = UUIDs.timeBased();
UUID tenantId2 = UUIDs.timeBased();
createTenantsAndSystemPlugins(tenantId1, tenantId2, "name_");
List<PluginMetaData> rules1 = pluginDao.findAllTenantPluginsByTenantId(tenantId1, new TextPageLink(40, "name_"));
assertEquals(40, rules1.size());
List<PluginMetaData> rules2 = pluginDao.findAllTenantPluginsByTenantId(tenantId1, new TextPageLink(40, "name_", rules1.get(19).getId().getId(), null));
assertEquals(20, rules2.size());
List<PluginMetaData> rules3 = pluginDao.findAllTenantPluginsByTenantId(tenantId1, new TextPageLink(40, "name_", rules2.get(19).getId().getId(), null));
assertEquals(0, rules3.size());
}
use of org.thingsboard.server.common.data.plugin.PluginMetaData in project thingsboard by thingsboard.
the class BasePluginServiceTest method findTenantPlugins.
@Test
public void findTenantPlugins() throws Exception {
TenantId tenantId = new TenantId(UUIDs.timeBased());
pluginService.savePlugin(generatePlugin(null, null));
pluginService.savePlugin(generatePlugin(null, null));
pluginService.savePlugin(generatePlugin(tenantId, null));
pluginService.savePlugin(generatePlugin(tenantId, null));
pluginService.savePlugin(generatePlugin(tenantId, null));
TextPageData<PluginMetaData> found = pluginService.findTenantPlugins(tenantId, new TextPageLink(100));
Assert.assertEquals(3, found.getData().size());
}
use of org.thingsboard.server.common.data.plugin.PluginMetaData in project thingsboard by thingsboard.
the class BasePluginServiceTest method deletePluginById.
@Test
public void deletePluginById() throws Exception {
PluginMetaData expected = pluginService.savePlugin(generatePlugin(null, null));
Assert.assertNotNull(expected.getId());
pluginService.deletePluginById(expected.getId());
PluginMetaData found = pluginService.findPluginById(expected.getId());
Assert.assertNull(found);
}
use of org.thingsboard.server.common.data.plugin.PluginMetaData in project thingsboard by thingsboard.
the class BasePluginServiceTest method deletePluginsByTenantId.
@Test
public void deletePluginsByTenantId() throws Exception {
TenantId tenantId = new TenantId(UUIDs.timeBased());
pluginService.savePlugin(generatePlugin(tenantId, null));
pluginService.savePlugin(generatePlugin(tenantId, null));
pluginService.savePlugin(generatePlugin(tenantId, null));
TextPageData<PluginMetaData> found = pluginService.findTenantPlugins(tenantId, new TextPageLink(100));
Assert.assertEquals(3, found.getData().size());
pluginService.deletePluginsByTenantId(tenantId);
found = pluginService.findTenantPlugins(tenantId, new TextPageLink(100));
Assert.assertEquals(0, found.getData().size());
}
Aggregations