delete componentDescriptors after test for JpaBaseComponentDescriptorDaoTest
This commit is contained in:
parent
770965a5d7
commit
6c92640117
@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
|
||||
"org.thingsboard.server.dao.sql.customer.*Test",
|
||||
"org.thingsboard.server.dao.sql.dashboard.*Test",
|
||||
"org.thingsboard.server.dao.sql.query.*Test",
|
||||
"org.thingsboard.server.dao.sql.device.*DeviceDaoTest",
|
||||
"org.thingsboard.server.dao.sql.device.*DeviceDaoTest"
|
||||
})
|
||||
public class JpaDaoTestSuite {
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ public class JpaBaseComponentDescriptorDaoTest extends AbstractJpaDaoTest {
|
||||
pageLink = pageLink.nextPageLink();
|
||||
PageData<ComponentDescriptor> components2 = componentDescriptorDao.findByTypeAndPageLink(AbstractServiceTest.SYSTEM_TENANT_ID,ComponentType.FILTER, pageLink);
|
||||
assertEquals(5, components2.getData().size());
|
||||
deleteComponentDescription(List.of(ComponentType.FILTER, ComponentType.ACTION));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -73,6 +74,7 @@ public class JpaBaseComponentDescriptorDaoTest extends AbstractJpaDaoTest {
|
||||
PageData<ComponentDescriptor> components2 = componentDescriptorDao.findByScopeAndTypeAndPageLink(AbstractServiceTest.SYSTEM_TENANT_ID,
|
||||
ComponentScope.SYSTEM, ComponentType.FILTER, pageLink);
|
||||
assertEquals(5, components2.getData().size());
|
||||
deleteComponentDescription(List.of(ComponentType.FILTER, ComponentType.ACTION, ComponentType.ENRICHMENT));
|
||||
}
|
||||
|
||||
private void createComponentDescriptor(ComponentType type, ComponentScope scope, int index) {
|
||||
@ -84,4 +86,14 @@ public class JpaBaseComponentDescriptorDaoTest extends AbstractJpaDaoTest {
|
||||
componentDescriptorDao.save(AbstractServiceTest.SYSTEM_TENANT_ID,component);
|
||||
}
|
||||
|
||||
void deleteComponentDescription(List<ComponentType> componentTypes) {
|
||||
for (ComponentType componentType : componentTypes) {
|
||||
List<ComponentDescriptor> byTypeAndPageLink = componentDescriptorDao.findByTypeAndPageLink(AbstractServiceTest.SYSTEM_TENANT_ID,
|
||||
componentType,
|
||||
new PageLink(100)).getData();
|
||||
for (ComponentDescriptor descriptor : byTypeAndPageLink) {
|
||||
componentDescriptorDao.deleteById(AbstractServiceTest.SYSTEM_TENANT_ID, descriptor.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user