|
|
|
@ -21,6 +21,7 @@ import org.junit.After; |
|
|
|
import org.junit.Assert; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import org.thingsboard.server.common.data.StringUtils; |
|
|
|
import org.thingsboard.server.common.data.Tenant; |
|
|
|
import org.thingsboard.server.common.data.edge.Edge; |
|
|
|
@ -86,19 +87,23 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest { |
|
|
|
ruleChainService.deleteRuleChainById(tenantId, savedRuleChain.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test(expected = DataValidationException.class) |
|
|
|
@Test |
|
|
|
public void testSaveRuleChainWithEmptyName() { |
|
|
|
RuleChain ruleChain = new RuleChain(); |
|
|
|
ruleChain.setTenantId(tenantId); |
|
|
|
ruleChainService.saveRuleChain(ruleChain); |
|
|
|
Assertions.assertThrows(DataValidationException.class, () -> { |
|
|
|
ruleChainService.saveRuleChain(ruleChain); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Test(expected = DataValidationException.class) |
|
|
|
@Test |
|
|
|
public void testSaveRuleChainWithInvalidTenant() { |
|
|
|
RuleChain ruleChain = new RuleChain(); |
|
|
|
ruleChain.setName("My RuleChain"); |
|
|
|
ruleChain.setTenantId(TenantId.fromUUID(Uuids.timeBased())); |
|
|
|
ruleChainService.saveRuleChain(ruleChain); |
|
|
|
Assertions.assertThrows(DataValidationException.class, () -> { |
|
|
|
ruleChainService.saveRuleChain(ruleChain); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
@ -321,14 +326,18 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest { |
|
|
|
ruleChainService.deleteRuleChainById(tenantId, savedRuleChainMetaData.getRuleChainId()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test(expected = DataValidationException.class) |
|
|
|
public void testUpdateRuleChainMetaDataWithCirclingRelation() throws Exception { |
|
|
|
ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation()); |
|
|
|
@Test |
|
|
|
public void testUpdateRuleChainMetaDataWithCirclingRelation() { |
|
|
|
Assertions.assertThrows(DataValidationException.class, () -> { |
|
|
|
ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation()); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Test(expected = DataValidationException.class) |
|
|
|
public void testUpdateRuleChainMetaDataWithCirclingRelation2() throws Exception { |
|
|
|
ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation2()); |
|
|
|
@Test |
|
|
|
public void testUpdateRuleChainMetaDataWithCirclingRelation2() { |
|
|
|
Assertions.assertThrows(DataValidationException.class, () -> { |
|
|
|
ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation2()); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|