InstallScriptsTest refactored. log added
This commit is contained in:
parent
b21a4693a2
commit
7c6d8b086b
@ -16,6 +16,7 @@
|
||||
package org.thingsboard.server.service.install;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@ -46,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.willReturn;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootTest(classes = {InstallScripts.class, RuleChainDataValidator.class})
|
||||
class InstallScriptsTest {
|
||||
|
||||
@ -80,16 +82,16 @@ class InstallScriptsTest {
|
||||
|
||||
@Test
|
||||
void testDefaultRuleChainsTemplates() throws IOException {
|
||||
Path tenantRuleChainsDir = installScripts.getTenantRuleChainsDir();
|
||||
List<Path> ruleChainsFromPath = installScripts.findRuleChainsFromPath(tenantRuleChainsDir);
|
||||
ruleChainsFromPath.forEach(this::validateRuleChainTemplate);
|
||||
Path dir = installScripts.getTenantRuleChainsDir();
|
||||
installScripts.findRuleChainsFromPath(dir)
|
||||
.forEach(this::validateRuleChainTemplate);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDefaultEdgeRuleChainsTemplates() throws IOException {
|
||||
Path edgeChainsDir = installScripts.getEdgeRuleChainsDir();
|
||||
List<Path> ruleChainsFromPath = installScripts.findRuleChainsFromPath(edgeChainsDir);
|
||||
ruleChainsFromPath.forEach(this::validateRuleChainTemplate);
|
||||
Path dir = installScripts.getEdgeRuleChainsDir();
|
||||
installScripts.findRuleChainsFromPath(dir)
|
||||
.forEach(this::validateRuleChainTemplate);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -98,6 +100,7 @@ class InstallScriptsTest {
|
||||
}
|
||||
|
||||
private void validateRuleChainTemplate(Path templateFilePath) {
|
||||
log.warn("validateRuleChainTemplate {}", templateFilePath);
|
||||
JsonNode ruleChainJson = JacksonUtil.toJsonNode(templateFilePath.toFile());
|
||||
|
||||
RuleChain ruleChain = JacksonUtil.treeToValue(ruleChainJson.get("ruleChain"), RuleChain.class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user