use of org.thingsboard.server.common.data.tenant.profile.TenantProfileData in project thingsboard by thingsboard.
the class BaseTenantProfileServiceTest method createTenantProfile.
public static TenantProfile createTenantProfile(String name) {
TenantProfile tenantProfile = new TenantProfile();
tenantProfile.setName(name);
tenantProfile.setDescription(name + " Test");
TenantProfileData profileData = new TenantProfileData();
profileData.setConfiguration(new DefaultTenantProfileConfiguration());
tenantProfile.setProfileData(profileData);
tenantProfile.setDefault(false);
tenantProfile.setIsolatedTbCore(false);
tenantProfile.setIsolatedTbRuleEngine(false);
return tenantProfile;
}
use of org.thingsboard.server.common.data.tenant.profile.TenantProfileData in project thingsboard by thingsboard.
the class BaseTenantServiceTest method testSaveTenantWithIsolatedProfileInMonolithSetup.
@Test(expected = DataValidationException.class)
public void testSaveTenantWithIsolatedProfileInMonolithSetup() {
TenantProfile tenantProfile = new TenantProfile();
tenantProfile.setName("Isolated Tenant Profile");
TenantProfileData profileData = new TenantProfileData();
profileData.setConfiguration(new DefaultTenantProfileConfiguration());
tenantProfile.setProfileData(profileData);
tenantProfile.setDefault(false);
tenantProfile.setIsolatedTbCore(true);
tenantProfile.setIsolatedTbRuleEngine(true);
TenantProfile isolatedTenantProfile = tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
Tenant tenant = new Tenant();
tenant.setTitle("Tenant");
tenant.setTenantProfileId(isolatedTenantProfile.getId());
tenantService.saveTenant(tenant);
}
use of org.thingsboard.server.common.data.tenant.profile.TenantProfileData in project thingsboard by thingsboard.
the class DefaultTransportRateLimitService method createRateLimits.
private EntityTransportRateLimits createRateLimits(TenantProfile tenantProfile, boolean tenant) {
TenantProfileData profileData = tenantProfile.getProfileData();
DefaultTenantProfileConfiguration profile = (DefaultTenantProfileConfiguration) profileData.getConfiguration();
if (profile == null) {
return new EntityTransportRateLimits(ALLOW, ALLOW, ALLOW);
} else {
TransportRateLimit regularMsgRateLimit = newLimit(tenant ? profile.getTransportTenantMsgRateLimit() : profile.getTransportDeviceMsgRateLimit());
TransportRateLimit telemetryMsgRateLimit = newLimit(tenant ? profile.getTransportTenantTelemetryMsgRateLimit() : profile.getTransportDeviceTelemetryMsgRateLimit());
TransportRateLimit telemetryDpRateLimit = newLimit(tenant ? profile.getTransportTenantTelemetryDataPointsRateLimit() : profile.getTransportTenantTelemetryDataPointsRateLimit());
return new EntityTransportRateLimits(regularMsgRateLimit, telemetryMsgRateLimit, telemetryDpRateLimit);
}
}
Aggregations