diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java index 3e9b7e06fd..e850bc8881 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java @@ -399,7 +399,7 @@ public class MockProcessContext extends MockControllerServiceLookup implements P @Override public String decrypt(final String encrypted) { if (encrypted.startsWith("enc{") && encrypted.endsWith("}")) { - return encrypted.substring(4, encrypted.length() - 2); + return encrypted.substring(4, encrypted.length() - 1); } return encrypted; } diff --git a/nifi-mock/src/test/java/org/apache/nifi/util/TestMockProcessContext.java b/nifi-mock/src/test/java/org/apache/nifi/util/TestMockProcessContext.java index d48af63348..f1137ed9d1 100644 --- a/nifi-mock/src/test/java/org/apache/nifi/util/TestMockProcessContext.java +++ b/nifi-mock/src/test/java/org/apache/nifi/util/TestMockProcessContext.java @@ -75,6 +75,17 @@ public class TestMockProcessContext { assertEquals(2, proc.getUpdateCount(DummyProcessor.DEFAULTED_PROP)); } + @Test + public void testFakeEncryptionAndDecryption() { + final DummyProcessor proc = new DummyProcessor(); + final MockProcessContext context = new MockProcessContext(proc); + String subject = "foo"; + String encrypted = context.encrypt(subject); + assertEquals(encrypted, "enc{foo}"); + String decrypted = context.decrypt(encrypted); + assertEquals(decrypted, subject); + } + private static class DummyProcessor extends AbstractProcessor { static final PropertyDescriptor REQUIRED_PROP = new PropertyDescriptor.Builder() .name("required") diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml index 03d401a259..cc53093a2f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml @@ -172,7 +172,7 @@ - + MockProcessContext