use of org.thingsboard.server.common.data.Dashboard in project thingsboard by thingsboard.
the class BaseDashboardServiceTest method testSaveDashboard.
@Test
public void testSaveDashboard() throws IOException {
Dashboard dashboard = new Dashboard();
dashboard.setTenantId(tenantId);
dashboard.setTitle("My dashboard");
Dashboard savedDashboard = dashboardService.saveDashboard(dashboard);
Assert.assertNotNull(savedDashboard);
Assert.assertNotNull(savedDashboard.getId());
Assert.assertTrue(savedDashboard.getCreatedTime() > 0);
Assert.assertEquals(dashboard.getTenantId(), savedDashboard.getTenantId());
Assert.assertEquals(dashboard.getTitle(), savedDashboard.getTitle());
savedDashboard.setTitle("My new dashboard");
dashboardService.saveDashboard(savedDashboard);
Dashboard foundDashboard = dashboardService.findDashboardById(savedDashboard.getId());
Assert.assertEquals(foundDashboard.getTitle(), savedDashboard.getTitle());
dashboardService.deleteDashboard(savedDashboard.getId());
}
use of org.thingsboard.server.common.data.Dashboard in project thingsboard by thingsboard.
the class BaseDashboardServiceTest method testSaveDashboardWithEmptyTenant.
@Test(expected = DataValidationException.class)
public void testSaveDashboardWithEmptyTenant() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
dashboardService.saveDashboard(dashboard);
}
use of org.thingsboard.server.common.data.Dashboard in project thingsboard by thingsboard.
the class BaseDashboardServiceTest method testFindDashboardById.
@Test
public void testFindDashboardById() {
Dashboard dashboard = new Dashboard();
dashboard.setTenantId(tenantId);
dashboard.setTitle("My dashboard");
Dashboard savedDashboard = dashboardService.saveDashboard(dashboard);
Dashboard foundDashboard = dashboardService.findDashboardById(savedDashboard.getId());
Assert.assertNotNull(foundDashboard);
Assert.assertEquals(savedDashboard, foundDashboard);
dashboardService.deleteDashboard(savedDashboard.getId());
}
Aggregations