This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 4b629beb1e8 NIFI-15726 Added XSLT Document property for entering  XSLT 
content in TransformXML (#11124)
4b629beb1e8 is described below

commit 4b629beb1e87eb009b3a7f56f4d46c3ec116be55
Author: dan-s1 <[email protected]>
AuthorDate: Thu Apr 23 10:24:42 2026 -0400

    NIFI-15726 Added XSLT Document property for entering  XSLT content in 
TransformXML (#11124)
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../nifi/processors/standard/TransformXml.java     | 86 +++++++++++++++-------
 .../nifi/processors/standard/TestTransformXml.java | 65 ++++++----------
 2 files changed, 80 insertions(+), 71 deletions(-)

diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java
index 60687d85799..49978ac89b8 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java
@@ -32,7 +32,9 @@ import org.apache.nifi.components.PropertyValue;
 import org.apache.nifi.components.ValidationContext;
 import org.apache.nifi.components.ValidationResult;
 import org.apache.nifi.components.resource.ResourceCardinality;
+import org.apache.nifi.components.resource.ResourceReference;
 import org.apache.nifi.components.resource.ResourceType;
+import org.apache.nifi.components.resource.Utf8TextResource;
 import org.apache.nifi.expression.AttributeExpression;
 import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
@@ -58,6 +60,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -98,20 +101,27 @@ public class TransformXml extends AbstractProcessor {
             "XSLT Lookup key"
     );
 
-    public static final PropertyDescriptor XSLT_FILE_NAME = new 
PropertyDescriptor.Builder()
-            .name("XSLT File Name")
-            .description("Provides the name (including full path) of the XSLT 
file to apply to the FlowFile XML content."
-                    + "One of the 'XSLT file name' and 'XSLT Lookup' 
properties must be defined.")
+    private static final List<String> OBSOLETE_XSLT_FILE_NAME = List.of(
+            "XSLT file name",
+            "XSLT File Name"
+    );
+
+    public static final PropertyDescriptor XSLT_DOCUMENT = new 
PropertyDescriptor.Builder()
+            .name("XSLT Document")
+            .description("""
+                    Provides either the name (including full path) of the XSLT 
file or the actual XSLT to apply to the FlowFile XML content.
+                    One of the 'XSLT Document' and 'XSLT Lookup' properties 
must be defined.""")
             .required(false)
             
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
-            .identifiesExternalResource(ResourceCardinality.SINGLE, 
ResourceType.FILE)
+            .identifiesExternalResource(ResourceCardinality.SINGLE, 
ResourceType.FILE, ResourceType.TEXT)
             .build();
 
     public static final PropertyDescriptor XSLT_CONTROLLER = new 
PropertyDescriptor.Builder()
             .name("XSLT Lookup")
-            .description("Controller lookup used to store XSLT definitions. 
One of the 'XSLT file name' and "
-                    + "'XSLT Lookup' properties must be defined. WARNING: note 
that the lookup controller service "
-                    + "should not be used to store large XSLT files.")
+            .description("""
+                    Controller lookup used to store XSLT definitions. One of 
the 'XSLT Document' and
+                    'XSLT Lookup' properties must be defined. WARNING: note 
that the lookup controller service
+                     should not be used to store large XSLT files.""")
             .required(false)
             .identifiesControllerService(StringLookupService.class)
             .build();
@@ -160,7 +170,7 @@ public class TransformXml extends AbstractProcessor {
             .build();
 
     private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = 
List.of(
-            XSLT_FILE_NAME,
+            XSLT_DOCUMENT,
             XSLT_CONTROLLER,
             XSLT_CONTROLLER_KEY,
             INDENT_OUTPUT,
@@ -186,7 +196,7 @@ public class TransformXml extends AbstractProcessor {
 
     private static final XMLStreamReaderProvider STREAM_READER_PROVIDER = new 
StandardXMLStreamReaderProvider();
 
-    private LoadingCache<String, Templates> cache;
+    private LoadingCache<ResourceReference, Templates> cache;
 
     private volatile boolean secureProcessingEnabled;
 
@@ -204,16 +214,16 @@ public class TransformXml extends AbstractProcessor {
     protected Collection<ValidationResult> customValidate(ValidationContext 
validationContext) {
         final List<ValidationResult> results = new 
ArrayList<>(super.customValidate(validationContext));
 
-        PropertyValue filename = validationContext.getProperty(XSLT_FILE_NAME);
+        PropertyValue document = validationContext.getProperty(XSLT_DOCUMENT);
         PropertyValue controller = 
validationContext.getProperty(XSLT_CONTROLLER);
         PropertyValue key = validationContext.getProperty(XSLT_CONTROLLER_KEY);
 
-        if ((filename.isSet() && controller.isSet())
-                || (!filename.isSet() && !controller.isSet())) {
+        if ((document.isSet() && controller.isSet())
+                || (!document.isSet() && !controller.isSet())) {
             results.add(new ValidationResult.Builder()
                     .valid(false)
                     .subject(this.getClass().getSimpleName())
-                    .explanation("Exactly one of the \"XSLT file name\" and 
\"XSLT controller\" properties must be defined.")
+                    .explanation("Exactly one of the \"XSLT Document\" and 
\"XSLT Lookup\" properties must be defined.")
                     .build());
         }
 
@@ -266,7 +276,7 @@ public class TransformXml extends AbstractProcessor {
                 cacheBuilder.expireAfterAccess(cacheTTL, TimeUnit.SECONDS);
             }
 
-            cache = cacheBuilder.build(path -> newTemplates(context, path));
+            cache = cacheBuilder.build(resourceReference -> 
newTemplates(context, resourceReference));
         } else {
             cache = null;
             logger.info("Stylesheet cache disabled because cache size is set 
to 0");
@@ -281,18 +291,23 @@ public class TransformXml extends AbstractProcessor {
         }
 
         final StopWatch stopWatch = new StopWatch(true);
-        final String path = context.getProperty(XSLT_FILE_NAME).isSet()
-                ? 
context.getProperty(XSLT_FILE_NAME).evaluateAttributeExpressions(original).getValue()
-                : 
context.getProperty(XSLT_CONTROLLER_KEY).evaluateAttributeExpressions(original).getValue();
+        final ResourceReference resourceReference;
+
+        if (context.getProperty(XSLT_DOCUMENT).isSet()) {
+            resourceReference = 
context.getProperty(XSLT_DOCUMENT).evaluateAttributeExpressions(original).asResource();
+        } else {
+            final String xsltLookupKeyValue = 
context.getProperty(XSLT_CONTROLLER_KEY).evaluateAttributeExpressions(original).getValue();
+            resourceReference = new Utf8TextResource(xsltLookupKeyValue);
+        }
 
         try {
             final FlowFile transformed = session.write(original, (inputStream, 
outputStream) -> {
                 try (final InputStream bufferedInputStream = new 
BufferedInputStream(inputStream)) {
                     final Templates templates;
                     if (cache == null) {
-                        templates = newTemplates(context, path);
+                        templates = newTemplates(context, resourceReference);
                     } else {
-                        templates = cache.get(path);
+                        templates = cache.get(resourceReference);
                     }
 
                     final Transformer transformer = templates.newTransformer();
@@ -312,7 +327,14 @@ public class TransformXml extends AbstractProcessor {
                     final Result result = new StreamResult(outputStream);
                     transformer.transform(source, result);
                 } catch (final Exception e) {
-                    throw new IOException(String.format("XSLT Source Path [%s] 
Transform Failed", path), e);
+                    final String message;
+                    if (resourceReference.getResourceType() == 
ResourceType.TEXT) {
+                        message = context.getProperty(XSLT_DOCUMENT).isSet()
+                                ? "XSLT Transform Failed" : 
String.format("XSLT Source Path [%s] Transform Failed", 
getResourceReferenceText(resourceReference));
+                    } else {
+                        message = String.format("XSLT Source Path [%s] 
Transform Failed", resourceReference.getLocation());
+                    }
+                    throw new IOException(message, e);
                 }
             });
             session.transfer(transformed, REL_SUCCESS);
@@ -332,7 +354,7 @@ public class TransformXml extends AbstractProcessor {
         config.renameProperty("secure-processing", 
SECURE_PROCESSING.getName());
         config.renameProperty("cache-size", CACHE_SIZE.getName());
         config.renameProperty("cache-ttl-after-last-access", 
CACHE_TTL_AFTER_LAST_ACCESS.getName());
-        config.renameProperty("XSLT file name", XSLT_FILE_NAME.getName());
+        OBSOLETE_XSLT_FILE_NAME.forEach(obsoletePropertyName -> 
config.renameProperty(obsoletePropertyName, XSLT_DOCUMENT.getName()));
     }
 
     private ErrorListenerLogger getErrorListenerLogger() {
@@ -340,11 +362,11 @@ public class TransformXml extends AbstractProcessor {
     }
 
     @SuppressWarnings("unchecked")
-    private Templates newTemplates(final ProcessContext context, final String 
path) throws TransformerConfigurationException, LookupFailureException {
+    private Templates newTemplates(final ProcessContext context, final 
ResourceReference resourceReference) throws TransformerConfigurationException, 
LookupFailureException, IOException {
         final TransformerFactory transformerFactory = getTransformerFactory();
         final LookupService<String> lookupService = 
context.getProperty(XSLT_CONTROLLER).asControllerService(LookupService.class);
-        final boolean filePath = context.getProperty(XSLT_FILE_NAME).isSet();
-        final StreamSource templateSource = getTemplateSource(lookupService, 
path, filePath);
+        final boolean xsltDocument = 
context.getProperty(XSLT_DOCUMENT).isSet();
+        final StreamSource templateSource = getTemplateSource(lookupService, 
resourceReference, xsltDocument);
         final Source configuredTemplateSource = secureProcessingEnabled ? 
getSecureSource(templateSource) : templateSource;
         return transformerFactory.newTemplates(configuredTemplateSource);
     }
@@ -361,12 +383,14 @@ public class TransformXml extends AbstractProcessor {
         return factory;
     }
 
-    private StreamSource getTemplateSource(final LookupService<String> 
lookupService, final String path, final boolean filePath) throws 
LookupFailureException {
+    private StreamSource getTemplateSource(final LookupService<String> 
lookupService, final ResourceReference resourceReference,
+                                           final boolean xsltDocument) throws 
LookupFailureException, IOException {
         final StreamSource streamSource;
-        if (filePath) {
-            streamSource = new StreamSource(path);
+        if (xsltDocument) {
+            streamSource = new StreamSource(resourceReference.read());
         } else {
             final String coordinateKey = 
lookupService.getRequiredKeys().iterator().next();
+            final String path = getResourceReferenceText(resourceReference);
             final Map<String, Object> coordinates = 
Collections.singletonMap(coordinateKey, path);
             final Optional<String> foundSource = 
lookupService.lookup(coordinates);
             if (foundSource.isPresent() && 
StringUtils.isNotBlank(foundSource.get())) {
@@ -403,6 +427,12 @@ public class TransformXml extends AbstractProcessor {
         }
     }
 
+    private String getResourceReferenceText(final ResourceReference 
resourceReference) throws IOException {
+        try (InputStream inputStream = resourceReference.read()) {
+            return new String(inputStream.readAllBytes(), 
StandardCharsets.UTF_8);
+        }
+    }
+
     private static class ErrorListenerLogger implements ErrorListener {
         private final ComponentLog logger;
 
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformXml.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformXml.java
index 262d784fb2c..ad234a0fb3f 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformXml.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformXml.java
@@ -28,7 +28,6 @@ import org.apache.nifi.util.TestRunner;
 import org.apache.nifi.util.TestRunners;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -38,7 +37,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.List;
@@ -59,23 +57,14 @@ public class TestTransformXml {
 
     private TestRunner runner;
 
-    @TempDir
-    private Path temptDir;
-
     @BeforeEach
     void setUp() {
         runner = TestRunners.newTestRunner(TransformXml.class);
     }
 
-    @Test
-    public void testStylesheetNotFound() {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"/no/path/to/math.xsl");
-        runner.assertNotValid();
-    }
-
     @Test
     public void testNonXmlContent() {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/math.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/math.xsl");
 
         final Map<String, String> attributes = new HashMap<>();
         runner.enqueue("not xml".getBytes(), attributes);
@@ -90,7 +79,7 @@ public class TestTransformXml {
     @Test
     public void testTransformMath() throws IOException {
         runner.setProperty("header", "Test for mod");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/math.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/math.xsl");
 
         final Map<String, String> attributes = new HashMap<>();
         
runner.enqueue(Paths.get("src/test/resources/TestTransformXml/math.xml"), 
attributes);
@@ -105,7 +94,7 @@ public class TestTransformXml {
 
     @Test
     public void testTransformCsv() throws IOException {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/tokens.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/tokens.xsl");
         runner.setProperty("uuid_0", "${uuid_0}");
         runner.setProperty("uuid_1", "${uuid_1}");
 
@@ -139,7 +128,7 @@ public class TestTransformXml {
     @Test
     public void testTransformExpressionLanguage() throws IOException {
         runner.setProperty("header", "Test for mod");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, "${xslt.path}");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, "${xslt.path}");
 
         final Map<String, String> attributes = new HashMap<>();
         attributes.put("xslt.path", 
"src/test/resources/TestTransformXml/math.xsl");
@@ -157,7 +146,7 @@ public class TestTransformXml {
     public void testTransformNoCache() throws IOException {
         runner.setProperty("header", "Test for mod");
         runner.setProperty(TransformXml.CACHE_SIZE, "0");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/math.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/math.xsl");
         
runner.enqueue(Paths.get("src/test/resources/TestTransformXml/math.xml"));
         runner.run();
 
@@ -170,7 +159,7 @@ public class TestTransformXml {
 
     @Test
     public void testTransformBothControllerFileNotValid() throws 
InitializationException {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/math.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/math.xsl");
 
         final SimpleKeyValueLookupService service = new 
SimpleKeyValueLookupService();
         runner.addControllerService("simple-key-value-lookup-service", 
service);
@@ -284,7 +273,7 @@ public class TestTransformXml {
 
     @Test
     public void 
testTransformSecureProcessingEnabledXmlWithDocumentTypeDefinition() {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/doc-node.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/doc-node.xsl");
         runner.setProperty(TransformXml.INDENT_OUTPUT, 
Boolean.FALSE.toString());
         runner.setProperty(TransformXml.SECURE_PROCESSING, 
Boolean.TRUE.toString());
 
@@ -301,7 +290,7 @@ public class TestTransformXml {
 
     @Test
     public void testTransformSecureProcessingEnabledXmlWithEntity() {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/doc-node.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/doc-node.xsl");
         runner.setProperty(TransformXml.INDENT_OUTPUT, 
Boolean.FALSE.toString());
 
         final String input = "<!DOCTYPE doc [<!ENTITY uri SYSTEM 
\"http://127.0.0.1\"; >]><doc>&uri;</doc>";
@@ -313,7 +302,7 @@ public class TestTransformXml {
 
     @Test
     public void testTransformSecureProcessingEnabledXslWithEntity() throws 
IOException {
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/doctype-entity-file-uri.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/doctype-entity-file-uri.xsl");
         runner.setProperty(TransformXml.INDENT_OUTPUT, 
Boolean.FALSE.toString());
 
         
runner.enqueue(Paths.get("src/test/resources/TestTransformXml/doctype-entity-file-uri.xsl"));
@@ -328,7 +317,7 @@ public class TestTransformXml {
     @Test
     public void testNonMatchingTemplateTag() throws IOException {
         runner.setProperty("header", "Test for mod");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/nonMatchingEndTag.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/nonMatchingEndTag.xsl");
 
         
runner.enqueue(Paths.get("src/test/resources/TestTransformXml/math.xml"));
         runner.run();
@@ -343,7 +332,7 @@ public class TestTransformXml {
     @Test
     public void testMessageTerminate() throws IOException {
         runner.setProperty("header", "Test message terminate");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/employeeMessageTerminate.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/employeeMessageTerminate.xsl");
 
         
runner.enqueue(Paths.get("src/test/resources/TestTransformXml/employee.xml"));
         runner.run();
@@ -358,7 +347,7 @@ public class TestTransformXml {
     @Test
     public void testMessageNonTerminate() throws IOException {
         runner.setProperty("header", "Test message non terminate");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, 
"src/test/resources/TestTransformXml/employeeMessageNonTerminate.xsl");
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, 
"src/test/resources/TestTransformXml/employeeMessageNonTerminate.xsl");
 
         
runner.enqueue(Paths.get("src/test/resources/TestTransformXml/employee.xml"));
         runner.run();
@@ -374,7 +363,7 @@ public class TestTransformXml {
     }
 
     @Test
-    void testParameterDeclaredAndSet() throws IOException {
+    void testParameterDeclaredAndSet() {
         final String xslt = """
                 <?xml version="1.0" encoding="UTF-8"?>
                 <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
@@ -389,8 +378,7 @@ public class TestTransformXml {
                 </xsl:stylesheet>
                 """;
 
-        final Path xsltPath = writeXslt(xslt, "someTransform.xslt");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, xsltPath.toString());
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, xslt);
         runner.setProperty("customParam", "From NIFI");
         runner.enqueue(XML_FOR_TESTING_PARAMETERS);
 
@@ -408,7 +396,7 @@ public class TestTransformXml {
     }
 
     @Test
-    void testParameterSetButNotDeclared() throws IOException {
+    void testParameterSetButNotDeclared() {
         final String xslt = """
                 <?xml version="1.0" encoding="UTF-8"?>
                 <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
@@ -422,8 +410,7 @@ public class TestTransformXml {
                 </xsl:stylesheet>
                 """;
 
-        final Path xsltPath = writeXslt(xslt, "someTransform.xslt");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, xsltPath.toString());
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, xslt);
         runner.setProperty("customParam", "From NIFI");
         runner.enqueue(XML_FOR_TESTING_PARAMETERS);
 
@@ -443,7 +430,7 @@ public class TestTransformXml {
     }
 
     @Test
-    void testParameterNotDeclaredButUsedInXslt() throws IOException {
+    void testParameterNotDeclaredButUsedInXslt() {
         final String xslt = """
                 <?xml version="1.0" encoding="UTF-8"?>
                 <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
@@ -457,8 +444,7 @@ public class TestTransformXml {
                 </xsl:stylesheet>
                 """;
 
-        final Path xsltPath = writeXslt(xslt, "someTransform.xslt");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, xsltPath.toString());
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, xslt);
         runner.setProperty("customParam", "From NIFI");
         runner.enqueue(XML_FOR_TESTING_PARAMETERS);
 
@@ -472,11 +458,10 @@ public class TestTransformXml {
 
     @ParameterizedTest
     @MethodSource("parameterAsSpecificTypeArgs")
-    void testParameterAsSpecificType(String paramType, String parameterValue, 
String defaultValue, Relationship expectedRelationship, String 
expectedTransform) throws IOException {
+    void testParameterAsSpecificType(String paramType, String parameterValue, 
String defaultValue, Relationship expectedRelationship, String 
expectedTransform) {
         final String parameterName = "customParam";
         final String xslt = getXSLTWithParameterDefinedWithType(paramType, 
defaultValue);
-        final Path xsltPath = writeXslt(xslt, "someTransform.xslt");
-        runner.setProperty(TransformXml.XSLT_FILE_NAME, xsltPath.toString());
+        runner.setProperty(TransformXml.XSLT_DOCUMENT, xslt);
         runner.setProperty(parameterName, parameterValue);
         runner.enqueue(XML_FOR_TESTING_PARAMETERS);
 
@@ -579,17 +564,11 @@ public class TestTransformXml {
                 Map.entry("secure-processing", 
TransformXml.SECURE_PROCESSING.getName()),
                 Map.entry("cache-size", TransformXml.CACHE_SIZE.getName()),
                 Map.entry("cache-ttl-after-last-access", 
TransformXml.CACHE_TTL_AFTER_LAST_ACCESS.getName()),
-                Map.entry("XSLT file name", 
TransformXml.XSLT_FILE_NAME.getName())
+                Map.entry("XSLT file name", 
TransformXml.XSLT_DOCUMENT.getName()),
+                Map.entry("XSLT File Name", 
TransformXml.XSLT_DOCUMENT.getName())
         );
 
         final PropertyMigrationResult propertyMigrationResult = 
runner.migrateProperties();
         assertEquals(expectedRenamed, 
propertyMigrationResult.getPropertiesRenamed());
     }
-
-    private Path writeXslt(String xslt, String xsltName) throws IOException {
-        final Path xsltPath = temptDir.resolve(xsltName);
-        Files.writeString(xsltPath, xslt);
-
-        return xsltPath;
-    }
 }

Reply via email to