Search in sources :

Example 6 with TenantProfileData

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;
}
Also used : TenantProfileData(org.thingsboard.server.common.data.tenant.profile.TenantProfileData) TenantProfile(org.thingsboard.server.common.data.TenantProfile) DefaultTenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration)

Example 7 with TenantProfileData

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);
}
Also used : Tenant(org.thingsboard.server.common.data.Tenant) TenantProfileData(org.thingsboard.server.common.data.tenant.profile.TenantProfileData) TenantProfile(org.thingsboard.server.common.data.TenantProfile) DefaultTenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration) Test(org.junit.Test)

Example 8 with TenantProfileData

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);
    }
}
Also used : TenantProfileData(org.thingsboard.server.common.data.tenant.profile.TenantProfileData) DefaultTenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration)

Aggregations

TenantProfileData (org.thingsboard.server.common.data.tenant.profile.TenantProfileData)8 DefaultTenantProfileConfiguration (org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration)7 TenantProfile (org.thingsboard.server.common.data.TenantProfile)5 Test (org.junit.Test)1 ApiFeature (org.thingsboard.server.common.data.ApiFeature)1 ApiUsageStateValue (org.thingsboard.server.common.data.ApiUsageStateValue)1 Tenant (org.thingsboard.server.common.data.Tenant)1 DataValidationException (org.thingsboard.server.dao.exception.DataValidationException)1