diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/serialization/StandardFlowSerializerTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/serialization/StandardFlowSerializerTest.java index 374d21b8be..b0a00d02e1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/serialization/StandardFlowSerializerTest.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/serialization/StandardFlowSerializerTest.java @@ -63,6 +63,8 @@ public class StandardFlowSerializerTest { private static final String SERIALIZED_VARIABLE_NAME = "Name with escape needed"; private static final String RAW_VARIABLE_VALUE = "Value with \u0001 escape needed"; private static final String SERIALIZED_VARIABLE_VALUE = "Value with escape needed"; + private static final String RAW_STRING_WITH_EMOJI = "String with \uD83D\uDCA7 droplet emoji"; + private static final String SERIALIZED_STRING_WITH_EMOJI = "String with 💧 droplet emoji"; private volatile String propsFile = StandardFlowSerializerTest.class.getResource("/standardflowserializertest.nifi.properties").getFile(); @@ -128,4 +130,25 @@ public class StandardFlowSerializerTest { assertFalse(serializedFlow.contains(RAW_VARIABLE_VALUE)); assertFalse(serializedFlow.contains("\u0001")); } + + @Test + public void testSerializationEmoji() throws Exception { + final ProcessorNode dummy = controller.getFlowManager().createProcessor(DummyScheduledProcessor.class.getName(), + UUID.randomUUID().toString(), systemBundle.getBundleDetails().getCoordinate()); + + dummy.setName(RAW_STRING_WITH_EMOJI); + controller.getFlowManager().getRootGroup().addProcessor(dummy); + + controller.getFlowManager().getRootGroup().setVariables(Collections.singletonMap(RAW_STRING_WITH_EMOJI, RAW_STRING_WITH_EMOJI)); + + // serialize the controller + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + final Document doc = serializer.transform(controller, ScheduledStateLookup.IDENTITY_LOOKUP); + serializer.serialize(doc, os); + + // verify the results contain the serialized string + final String serializedFlow = os.toString(StandardCharsets.UTF_8.name()); + assertTrue(serializedFlow.contains(SERIALIZED_STRING_WITH_EMOJI)); + assertFalse(serializedFlow.contains(RAW_STRING_WITH_EMOJI)); + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/pom.xml index 8c79780366..5cc228f8ec 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/pom.xml @@ -540,6 +540,10 @@ com.io7m.xom xom + + xalan + xalan +