use of org.thingsboard.server.common.data.widget.WidgetsBundle in project thingsboard by thingsboard.
the class BaseWidgetsBundleControllerTest method testSaveWidgetsBundleWithEmptyTitle.
@Test
public void testSaveWidgetsBundleWithEmptyTitle() throws Exception {
WidgetsBundle widgetsBundle = new WidgetsBundle();
doPost("/api/widgetsBundle", widgetsBundle).andExpect(status().isBadRequest()).andExpect(statusReason(containsString("Widgets bundle title should be specified")));
}
use of org.thingsboard.server.common.data.widget.WidgetsBundle in project thingsboard by thingsboard.
the class BaseWidgetsBundleControllerTest method testFindTenantWidgetsBundlesByPageLink.
@Test
public void testFindTenantWidgetsBundlesByPageLink() throws Exception {
login(tenantAdmin.getEmail(), "testPassword1");
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?", new TypeReference<List<WidgetsBundle>>() {
});
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
for (int i = 0; i < 73; i++) {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTitle("Widgets bundle" + i);
widgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
}
widgetsBundles.addAll(sysWidgetsBundles);
List<WidgetsBundle> loadedWidgetsBundles = new ArrayList<>();
TextPageLink pageLink = new TextPageLink(14);
TextPageData<WidgetsBundle> pageData;
do {
pageData = doGetTypedWithPageLink("/api/widgetsBundles?", new TypeReference<TextPageData<WidgetsBundle>>() {
}, pageLink);
loadedWidgetsBundles.addAll(pageData.getData());
if (pageData.hasNext()) {
pageLink = pageData.getNextPageLink();
}
} while (pageData.hasNext());
Collections.sort(widgetsBundles, idComparator);
Collections.sort(loadedWidgetsBundles, idComparator);
Assert.assertEquals(widgetsBundles, loadedWidgetsBundles);
}
use of org.thingsboard.server.common.data.widget.WidgetsBundle in project thingsboard by thingsboard.
the class BaseWidgetsBundleControllerTest method testFindTenantWidgetsBundles.
@Test
public void testFindTenantWidgetsBundles() throws Exception {
login(tenantAdmin.getEmail(), "testPassword1");
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?", new TypeReference<List<WidgetsBundle>>() {
});
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
for (int i = 0; i < 73; i++) {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTitle("Widgets bundle" + i);
widgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
}
widgetsBundles.addAll(sysWidgetsBundles);
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?", new TypeReference<List<WidgetsBundle>>() {
});
Collections.sort(widgetsBundles, idComparator);
Collections.sort(loadedWidgetsBundles, idComparator);
Assert.assertEquals(widgetsBundles, loadedWidgetsBundles);
}
Aggregations