From 8a7f0797a20a49c03ef11817d74c45920336f537 Mon Sep 17 00:00:00 2001 From: Sven Hettwer Date: Fri, 12 Apr 2019 14:12:48 +0200 Subject: [PATCH] (citrusframework/citrus-db#28) Added getBlob to JdbcResultSet + Altered Blob IT --- .../com/consol/citrus/jdbc/JdbcExecutionsIT.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 f7b5f43085..deaa8c5b98 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.io.IOUtils; import org.springframework.core.io.ClassPathResource; import org.testng.Assert; import org.testng.annotations.AfterMethod; @@ -328,9 +329,12 @@ public void testBlobIntegration() throws IOException { //GIVEN final String sql = "{? = CALL someClobFunction(?)}"; + final ClassPathResource blobRequestValue = new ClassPathResource("jdbc/RequestBlob.pdf"); - final ClassPathResource blobReturnValue = new ClassPathResource("jdbc/ResponseBlob.pdf"); + final String requestBlobContent = IOUtils.toString(blobRequestValue.getInputStream(), "UTF8"); + final ClassPathResource blobReturnValue = new ClassPathResource("jdbc/ResponseBlob.pdf"); + final String responseBlobContent = IOUtils.toString(blobReturnValue.getInputStream(), "UTF8"); //WHEN + THEN async().actions(new AbstractTestAction() { @@ -341,7 +345,7 @@ public void doExecute(final TestContext context) { Assert.assertNotNull(connection); try(final PreparedStatement statement = connection.prepareStatement(sql)){ - statement.setBinaryStream(1, blobRequestValue.getInputStream()); + statement.setBlob(1, blobRequestValue.getInputStream()); statement.execute(); final ResultSet resultSet = statement.getResultSet(); @@ -359,14 +363,14 @@ public void doExecute(final TestContext context) { ); receive(jdbcServer) - .message(JdbcMessage.execute("{? = CALL someClobFunction(?)} - ("+blobRequestValue+")")); + .message(JdbcMessage.execute("{? = CALL someClobFunction(?)} - ("+requestBlobContent+")")); send(jdbcServer) .messageType(MessageType.XML) .message(JdbcMessage.success().dataSet("" + "" + "" + - ""+blobReturnValue.getInputStream()+""+ + ""+responseBlobContent+""+ "" + "")); }