Search in sources :

Example 11 with CursorStreamProvider

use of org.mule.runtime.api.streaming.bytes.CursorStreamProvider in project mule by mulesoft.

the class OperationMessageProcessorTestCase method cursorStreamProvidersAreManaged.

@Test
public void cursorStreamProvidersAreManaged() throws Exception {
    CursorStreamProvider provider = mock(CursorStreamProvider.class);
    final InputStream inputStream = mock(InputStream.class);
    doReturn(provider).when(cursorStreamProviderFactory).of(event, inputStream);
    doReturn(provider).when(streamingManager).manage(provider, event);
    when(operationExecutor.execute(any())).thenReturn(just(inputStream));
    messageProcessor.process(event);
    verify(streamingManager).manage(same(provider), any());
}
Also used : CursorStreamProvider(org.mule.runtime.api.streaming.bytes.CursorStreamProvider) InputStream(java.io.InputStream) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 12 with CursorStreamProvider

use of org.mule.runtime.api.streaming.bytes.CursorStreamProvider in project mule by mulesoft.

the class StreamingUtilsTestCase method consumeRepeatableInputStreamPayload.

@Test
@Description("Test that repeatable stream in the payload is consumed into another fully in memory stream provider")
public void consumeRepeatableInputStreamPayload() throws Exception {
    CursorStreamProvider payload = asCursorProvider(TEST_PAYLOAD);
    CoreEvent event = consumeRepeatablePayload(getEventBuilder().message(Message.of(payload)).build());
    assertConsumedRepeatableInputStream(payload, event);
}
Also used : InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) CursorStreamProvider(org.mule.runtime.api.streaming.bytes.CursorStreamProvider) ByteArrayCursorStreamProvider(org.mule.runtime.core.internal.streaming.bytes.ByteArrayCursorStreamProvider) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

CursorStreamProvider (org.mule.runtime.api.streaming.bytes.CursorStreamProvider)12 Test (org.junit.Test)7 InputStream (java.io.InputStream)5 InMemoryCursorStreamProvider (org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider)4 SmallTest (org.mule.tck.size.SmallTest)4 Description (io.qameta.allure.Description)3 ByteArrayCursorStreamProvider (org.mule.runtime.core.internal.streaming.bytes.ByteArrayCursorStreamProvider)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 DataType (org.mule.runtime.api.metadata.DataType)2 SerializationException (org.mule.runtime.api.serialization.SerializationException)2 CursorStream (org.mule.runtime.api.streaming.bytes.CursorStream)2 CursorIteratorProvider (org.mule.runtime.api.streaming.object.CursorIteratorProvider)2 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)2 SimpleByteBufferManager (org.mule.tck.core.streaming.SimpleByteBufferManager)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileInputStream (java.io.FileInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1