public BlobOperationResponse uploadBlockBlob(final Exchange exchange) throws IOException {
        ObjectHelper.notNull(exchange, MISSING_EXCHANGE);

        final BlobStreamAndLength blobStreamAndLength = BlobStreamAndLength.createBlobStreamAndLengthFromExchangeBody(exchange);
        final BlobCommonRequestOptions commonRequestOptions = getCommonRequestOptions(exchange);

        if (LOG.isTraceEnabled()) {
            LOG.trace("Putting a block blob [{}] from exchange [{}]...", configurationProxy.getBlobName(exchange), exchange);
        }

        try {
            final Response<BlockBlobItem> response = client.uploadBlockBlob(blobStreamAndLength.getInputStream(),
                    blobStreamAndLength.getStreamLength(), commonRequestOptions.getBlobHttpHeaders(),
                    commonRequestOptions.getMetadata(), commonRequestOptions.getAccessTier(),
                    commonRequestOptions.getContentMD5(), commonRequestOptions.getBlobRequestConditions(),
                    commonRequestOptions.getTimeout());

            return BlobOperationResponse.createWithEmptyBody(response);
        } finally {
            closeInputStreamIfNeeded(blobStreamAndLength.getInputStream());
        }
    }
@Test
    void testUploadBlockBlob() throws Exception {
        // mocking
        final BlockBlobItem blockBlobItem = new BlockBlobItem("testTag", OffsetDateTime.now(), null, false, null);
        final HttpHeaders httpHeaders = new HttpHeaders().set("x-test-header", "123");

        when(client.uploadBlockBlob(any(), anyLong(), any(), any(), any(), any(), any(), any()))
                .thenReturn(new ResponseBase<>(null, 200, httpHeaders, blockBlobItem, null));

        final Exchange exchange = new DefaultExchange(context);
        exchange.getIn().setBody(new ByteArrayInputStream("test".getBytes(Charset.defaultCharset())));

        // test upload with input stream
        final BlobOperations operations = new BlobOperations(configuration, client);

        final BlobOperationResponse operationResponse = operations.uploadBlockBlob(exchange);

        assertNotNull(operationResponse);
        assertTrue((boolean) operationResponse.getBody());
        assertNotNull(operationResponse.getHeaders());
        assertEquals("testTag", operationResponse.getHeaders().get(BlobConstants.E_TAG));
        assertEquals("123", ((HttpHeaders) operationResponse.getHeaders().get(BlobConstants.RAW_HTTP_HEADERS))
                .get("x-test-header").getValue());
    }