From b90bdfcd8d42dda437c4ad8f7aa45dd4e877d2fc Mon Sep 17 00:00:00 2001 From: Sven Hettwer Date: Mon, 15 Apr 2019 16:45:23 +0200 Subject: [PATCH] (citrusframework/citrus-db#28) Added Base64 encoding to binary data to be able to compare values without triggering citrus variable substitution --- .../it/java/com/consol/citrus/jdbc/JdbcExecutionsIT.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/citrus-integration/src/it/java/com/consol/citrus/jdbc/JdbcExecutionsIT.java b/modules/citrus-integration/src/it/java/com/consol/citrus/jdbc/JdbcExecutionsIT.java index deaa8c5b98..7eac667c5d 100644 --- a/modules/citrus-integration/src/it/java/com/consol/citrus/jdbc/JdbcExecutionsIT.java +++ b/modules/citrus-integration/src/it/java/com/consol/citrus/jdbc/JdbcExecutionsIT.java @@ -27,6 +27,7 @@ import com.consol.citrus.jdbc.message.JdbcMessage; import com.consol.citrus.jdbc.server.JdbcServer; import com.consol.citrus.message.MessageType; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import org.springframework.core.io.ClassPathResource; import org.testng.Assert; @@ -331,10 +332,10 @@ public void testBlobIntegration() throws IOException { final String sql = "{? = CALL someClobFunction(?)}"; final ClassPathResource blobRequestValue = new ClassPathResource("jdbc/RequestBlob.pdf"); - final String requestBlobContent = IOUtils.toString(blobRequestValue.getInputStream(), "UTF8"); + final String requestBlobContent = Base64.encodeBase64String(IOUtils.toByteArray(blobRequestValue.getInputStream())); final ClassPathResource blobReturnValue = new ClassPathResource("jdbc/ResponseBlob.pdf"); - final String responseBlobContent = IOUtils.toString(blobReturnValue.getInputStream(), "UTF8"); + final String responseBlobContent = Base64.encodeBase64String(IOUtils.toByteArray(blobReturnValue.getInputStream())); //WHEN + THEN async().actions(new AbstractTestAction() { @@ -353,7 +354,9 @@ public void doExecute(final TestContext context) { final Blob responseBlob = resultSet.getBlob(1); - assertEquals(blobReturnValue.getInputStream(), responseBlob.getBinaryStream()); + assertEquals( + IOUtils.toString(blobReturnValue.getInputStream(), "UTF8"), + IOUtils.toString(responseBlob.getBinaryStream(),"UTF8")); } } catch (final SQLException | AssertionError | IOException e) { throw new CitrusRuntimeException(e);