Search in sources :

Example 11 with Dashboard

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());
}
Also used : Dashboard(org.thingsboard.server.common.data.Dashboard) Test(org.junit.Test)

Example 12 with Dashboard

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);
}
Also used : Dashboard(org.thingsboard.server.common.data.Dashboard) Test(org.junit.Test)

Example 13 with 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());
}
Also used : Dashboard(org.thingsboard.server.common.data.Dashboard) Test(org.junit.Test)

Aggregations

Dashboard (org.thingsboard.server.common.data.Dashboard)13 Test (org.junit.Test)11 TenantId (org.thingsboard.server.common.data.id.TenantId)5 ArrayList (java.util.ArrayList)3 DashboardInfo (org.thingsboard.server.common.data.DashboardInfo)3 Tenant (org.thingsboard.server.common.data.Tenant)3 IOException (java.io.IOException)2 Customer (org.thingsboard.server.common.data.Customer)2 CustomerId (org.thingsboard.server.common.data.id.CustomerId)2 DashboardId (org.thingsboard.server.common.data.id.DashboardId)2 TextPageLink (org.thingsboard.server.common.data.page.TextPageLink)2 TimePageLink (org.thingsboard.server.common.data.page.TimePageLink)1