From 7c6d8b086be2234ccf0d65dbae0a4120472153f4 Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Thu, 7 Sep 2023 00:09:35 +0200 Subject: [PATCH] InstallScriptsTest refactored. log added --- .../service/install/InstallScriptsTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/install/InstallScriptsTest.java b/application/src/test/java/org/thingsboard/server/service/install/InstallScriptsTest.java index 9b1d99c77a..26eead0ec7 100644 --- a/application/src/test/java/org/thingsboard/server/service/install/InstallScriptsTest.java +++ b/application/src/test/java/org/thingsboard/server/service/install/InstallScriptsTest.java @@ -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 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 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);