Search in sources :

Example 1 with SimpleByteBufferManager

use of org.mule.tck.core.streaming.SimpleByteBufferManager in project mule by mulesoft.

the class InputStreamToByteArrayTestCase method transformCursorStreamProvider.

@Test
public void transformCursorStreamProvider() throws Exception {
    InputStream inputStream = new ByteArrayInputStream(DONKEY.getBytes());
    CursorStreamProvider provider = new InMemoryCursorStreamProvider(inputStream, InMemoryCursorStreamConfig.getDefault(), new SimpleByteBufferManager());
    assertThat(transformer.transform(provider), equalTo(DONKEY.getBytes()));
}
Also used : InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) CursorStreamProvider(org.mule.runtime.api.streaming.bytes.CursorStreamProvider) SimpleByteBufferManager(org.mule.tck.core.streaming.SimpleByteBufferManager) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 2 with SimpleByteBufferManager

use of org.mule.tck.core.streaming.SimpleByteBufferManager in project mule by mulesoft.

the class FunctionExecutionTestCase method xpathWithDefaultNode.

@Test
public void xpathWithDefaultNode() throws Exception {
    InputStream stream = getDocumentStream();
    InMemoryCursorStreamProvider streamProvider = new InMemoryCursorStreamProvider(stream, InMemoryCursorStreamConfig.getDefault(), new SimpleByteBufferManager());
    Object value = flowRunner("xpathWithDefaultNode").withVariable("xmlPayload", streamProvider).run().getMessage().getPayload().getValue();
    assertThat(value, is("xpathWithDefaultNode"));
}
Also used : SimpleByteBufferManager(org.mule.tck.core.streaming.SimpleByteBufferManager) InputStream(java.io.InputStream) InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) Test(org.junit.Test)

Example 3 with SimpleByteBufferManager

use of org.mule.tck.core.streaming.SimpleByteBufferManager in project mule by mulesoft.

the class PetStoreSerializableParameterTestCase method cursorStreamProviderParameter.

@Test
public void cursorStreamProviderParameter() throws Exception {
    InputStream inputStream = new ByteArrayInputStream(DONKEY.getBytes());
    CursorStreamProvider provider = new InMemoryCursorStreamProvider(inputStream, InMemoryCursorStreamConfig.getDefault(), new SimpleByteBufferManager());
    Message message = flowRunner("dynamicSerializableParameter").withVariable("animal", provider).run().getMessage();
    assertThat(message.getPayload().getValue(), is(DONKEY));
}
Also used : InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) CursorStreamProvider(org.mule.runtime.api.streaming.bytes.CursorStreamProvider) SimpleByteBufferManager(org.mule.tck.core.streaming.SimpleByteBufferManager) Message(org.mule.runtime.api.message.Message) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)3 Test (org.junit.Test)3 InMemoryCursorStreamProvider (org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider)3 SimpleByteBufferManager (org.mule.tck.core.streaming.SimpleByteBufferManager)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 CursorStreamProvider (org.mule.runtime.api.streaming.bytes.CursorStreamProvider)2 Message (org.mule.runtime.api.message.Message)1 SmallTest (org.mule.tck.size.SmallTest)1