use of org.thingsboard.server.common.data.TenantProfile in project thingsboard by thingsboard.
the class BaseTenantProfileControllerTest method testSetDefaultTenantProfile.
@Test
public void testSetDefaultTenantProfile() throws Exception {
loginSysAdmin();
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile 1");
TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
TenantProfile defaultTenantProfile = doPost("/api/tenantProfile/" + savedTenantProfile.getId().getId().toString() + "/default", null, TenantProfile.class);
Assert.assertNotNull(defaultTenantProfile);
EntityInfo foundDefaultTenantProfile = doGet("/api/tenantProfileInfo/default", EntityInfo.class);
Assert.assertNotNull(foundDefaultTenantProfile);
Assert.assertEquals(savedTenantProfile.getName(), foundDefaultTenantProfile.getName());
Assert.assertEquals(savedTenantProfile.getId(), foundDefaultTenantProfile.getId());
}
use of org.thingsboard.server.common.data.TenantProfile in project thingsboard by thingsboard.
the class BaseTenantProfileControllerTest method testFindTenantProfileById.
@Test
public void testFindTenantProfileById() throws Exception {
loginSysAdmin();
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
TenantProfile foundTenantProfile = doGet("/api/tenantProfile/" + savedTenantProfile.getId().getId().toString(), TenantProfile.class);
Assert.assertNotNull(foundTenantProfile);
Assert.assertEquals(savedTenantProfile, foundTenantProfile);
}
use of org.thingsboard.server.common.data.TenantProfile in project thingsboard by thingsboard.
the class BaseTenantProfileControllerTest method testDeleteTenantProfile.
@Test
public void testDeleteTenantProfile() throws Exception {
loginSysAdmin();
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
doDelete("/api/tenantProfile/" + savedTenantProfile.getId().getId().toString()).andExpect(status().isOk());
doGet("/api/tenantProfile/" + savedTenantProfile.getId().getId().toString()).andExpect(status().isNotFound());
}
use of org.thingsboard.server.common.data.TenantProfile in project thingsboard by thingsboard.
the class BaseTenantProfileControllerTest method testFindTenantProfileInfoById.
@Test
public void testFindTenantProfileInfoById() throws Exception {
loginSysAdmin();
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
EntityInfo foundTenantProfileInfo = doGet("/api/tenantProfileInfo/" + savedTenantProfile.getId().getId().toString(), EntityInfo.class);
Assert.assertNotNull(foundTenantProfileInfo);
Assert.assertEquals(savedTenantProfile.getId(), foundTenantProfileInfo.getId());
Assert.assertEquals(savedTenantProfile.getName(), foundTenantProfileInfo.getName());
}
use of org.thingsboard.server.common.data.TenantProfile in project thingsboard by thingsboard.
the class BaseTenantProfileControllerTest method testDeleteTenantProfileWithExistingTenant.
@Test
public void testDeleteTenantProfileWithExistingTenant() throws Exception {
loginSysAdmin();
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
Tenant tenant = new Tenant();
tenant.setTitle("My tenant with tenant profile");
tenant.setTenantProfileId(savedTenantProfile.getId());
Tenant savedTenant = doPost("/api/tenant", tenant, Tenant.class);
doDelete("/api/tenantProfile/" + savedTenantProfile.getId().getId().toString()).andExpect(status().isBadRequest()).andExpect(statusReason(containsString("The tenant profile referenced by the tenants cannot be deleted")));
doDelete("/api/tenant/" + savedTenant.getId().getId().toString()).andExpect(status().isOk());
}
Aggregations