Search in sources :

Example 1 with DataSize

use of org.mule.runtime.api.util.DataSize in project mule by mulesoft.

the class CursorStreamProviderTestCase method dataLengthMatchesMaxBufferSizeExactly.

@Test
public void dataLengthMatchesMaxBufferSizeExactly() throws Exception {
    data = randomAlphabetic(maxBufferSize);
    final ByteArrayInputStream dataStream = new ByteArrayInputStream(data.getBytes());
    InMemoryCursorStreamConfig config = new InMemoryCursorStreamConfig(new DataSize(maxBufferSize, BYTE), new DataSize(0, BYTE), new DataSize(maxBufferSize, BYTE));
    streamProvider = new InMemoryCursorStreamProvider(dataStream, config, bufferManager);
    withCursor(cursor -> assertThat(IOUtils.toString(cursor), equalTo(data)));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) DataSize(org.mule.runtime.api.util.DataSize) InMemoryCursorStreamConfig(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamConfig) InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 Test (org.junit.Test)1 DataSize (org.mule.runtime.api.util.DataSize)1 InMemoryCursorStreamConfig (org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamConfig)1 InMemoryCursorStreamProvider (org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider)1 SmallTest (org.mule.tck.size.SmallTest)1