Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a unit test trying to repro service bus large message failure. #386

Merged
merged 1 commit into from
Jul 20, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ public class ServiceBusIntegrationTest extends IntegrationTestBase {
.setTimeout(5);
static ReceiveMessageOptions PEEK_LOCK_5_SECONDS = new ReceiveMessageOptions().setPeekLock().setTimeout(5);

private String createLongString(int length) {
String result = new String();
for (int i = 0; i < length; i++) {
result = result + "a";
}
return result;
}

@Before
public void createService() throws Exception {
// reinitialize configuration from known state
Expand Down Expand Up @@ -278,6 +286,26 @@ public void receiveMessageWorks() throws Exception {
assertArrayEquals("Hello World".getBytes(), Arrays.copyOf(data, size));
}

@Test
public void receiveLargeMessageWorks() throws Exception {
// Arrange
String queueName = "TestReceiveLargeMessageWorks";
service.createQueue(new QueueInfo(queueName));
String expectedBody = createLongString(64000);
BrokeredMessage expectedMessage = new BrokeredMessage(expectedBody);
service.sendQueueMessage(queueName, expectedMessage);

// Act
BrokeredMessage message = service.receiveQueueMessage(queueName, RECEIVE_AND_DELETE_5_SECONDS).getValue();
byte[] data = new byte[64000];
int size = message.getBody().read(data);

// Assert
assertEquals(expectedBody.length(), size);
assertArrayEquals(expectedBody.getBytes(), Arrays.copyOf(data, size));

}

@Test
public void renewSubscriptionMessageLockWorks() throws Exception {
// Arrange
Expand Down