diff --git a/bundles/org.openhab.transform.xslt/src/test/java/org/openhab/transform/xslt/internal/XsltTransformationServiceTest.java b/bundles/org.openhab.transform.xslt/src/test/java/org/openhab/transform/xslt/internal/XsltTransformationServiceTest.java index fd73a2acf71..40b8518f473 100644 --- a/bundles/org.openhab.transform.xslt/src/test/java/org/openhab/transform/xslt/internal/XsltTransformationServiceTest.java +++ b/bundles/org.openhab.transform.xslt/src/test/java/org/openhab/transform/xslt/internal/XsltTransformationServiceTest.java @@ -14,8 +14,15 @@ package org.openhab.transform.xslt.internal; import static org.junit.jupiter.api.Assertions.*; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.openhab.core.OpenHAB; import org.openhab.core.transform.TransformationException; /** @@ -25,13 +32,22 @@ public class XsltTransformationServiceTest extends AbstractTransformationService private XsltTransformationService processor; + private final Path transformHttpPath = Paths.get(OpenHAB.getConfigFolder()).resolve("transform/http"); + @BeforeEach - public void init() { + public void init() throws IOException { + if (!Files.exists(transformHttpPath)) { + Files.createDirectories(transformHttpPath); + } + processor = new XsltTransformationService(); } @Test - public void testTransformByXSLT() throws TransformationException { + public void testTransformByXSLT() throws TransformationException, IOException { + Files.copy(getClass().getResourceAsStream("google_weather.xsl"), + transformHttpPath.resolve("google_weather.xsl"), StandardCopyOption.REPLACE_EXISTING); + // method under test String transformedResponse = processor.transform("http/google_weather.xsl", source); diff --git a/bundles/org.openhab.transform.xslt/conf/transform/http/google_weather.xsl b/bundles/org.openhab.transform.xslt/src/test/resources/org/openhab/transform/xslt/internal/google_weather.xsl similarity index 100% rename from bundles/org.openhab.transform.xslt/conf/transform/http/google_weather.xsl rename to bundles/org.openhab.transform.xslt/src/test/resources/org/openhab/transform/xslt/internal/google_weather.xsl diff --git a/pom.xml b/pom.xml index c760b31437a..0b2c159a5dc 100644 --- a/pom.xml +++ b/pom.xml @@ -419,6 +419,9 @@ Import-Package: \\ 15 m + ${project.build.directory}/openhab/conf + ${project.build.directory}/openhab/runtime + ${project.build.directory}/openhab/userdata