Skip to content

Commit

Permalink
[Java] Eliminate the direct usage of the org.apache.commons.io library
Browse files Browse the repository at this point in the history
- Use java.nio.charset.StandardCharsets instead.
- This way the maven module commons-io:commons-io is not needed anymore.

Change-Id: I381018e0a0d41411db8e5b2fdca13352e14b9346
  • Loading branch information
Sarah Nieswand authored and Sarah Nieswand committed Jan 16, 2019
1 parent 4e486bc commit 1f800a6
Showing 1 changed file with 9 additions and 6 deletions.
Expand Up @@ -33,6 +33,7 @@
import io.joynr.messaging.serialize.JoynrUntypedObjectDeserializer;
import io.joynr.messaging.util.Utilities;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand All @@ -43,7 +44,6 @@
import joynr.ImmutableMessage;
import joynr.test.JoynrTestLoggingRule;

import org.apache.commons.io.Charsets;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
Expand Down Expand Up @@ -137,11 +137,13 @@ public void testSendAndReceiveMessagesOnAtmosphereServer() throws Exception {
long startTime_ms = System.currentTimeMillis();
ScheduledFuture<Response> longPollConsumer = bpMock.longPollInOwnThread(channelId, 30000);

byte[] postPayload = (payload + index++ + "-" + UUID.randomUUID().toString()).getBytes(Charsets.UTF_8);
byte[] postPayload = (payload + index++ + "-"
+ UUID.randomUUID().toString()).getBytes(StandardCharsets.UTF_8);
expectedPayloads.add(postPayload);
ScheduledFuture<Response> postMessage = bpMock.postMessageInOwnThread(channelId, 5000, postPayload);

byte[] postPayload2 = (payload + index++ + "-" + UUID.randomUUID().toString()).getBytes(Charsets.UTF_8);
byte[] postPayload2 = (payload + index++ + "-"
+ UUID.randomUUID().toString()).getBytes(StandardCharsets.UTF_8);
expectedPayloads.add(postPayload2);
ScheduledFuture<Response> postMessage2 = bpMock.postMessageInOwnThread(channelId, 5000, postPayload2);

Expand Down Expand Up @@ -203,7 +205,7 @@ public void testSendAndReceiveMessagesConcurrently() throws Exception {

ScheduledFuture<Response> longPollConsumer = bpMock.longPollInOwnThread(channelId, 30000);

byte[] postPayload = (payload + i + "-" + UUID.randomUUID().toString()).getBytes(Charsets.UTF_8);
byte[] postPayload = (payload + i + "-" + UUID.randomUUID().toString()).getBytes(StandardCharsets.UTF_8);
expectedPayloads.add(postPayload);
ScheduledFuture<Response> postMessage = bpMock.postMessageInOwnThread(channelId, 5000, postPayload);

Expand Down Expand Up @@ -245,7 +247,7 @@ public void testOpenAndCloseChannels() throws Exception {
for (String channel : channels) {
bpMock.postMessageInOwnThread(channel,
10000,
("payload-" + UUID.randomUUID().toString()).getBytes(Charsets.UTF_8));
("payload-" + UUID.randomUUID().toString()).getBytes(StandardCharsets.UTF_8));
Thread.sleep(50);

}
Expand All @@ -261,7 +263,8 @@ public void testOpenAndCloseChannels() throws Exception {
@Test
public void testPostMessageToNonExistingChannel() throws Exception {

byte[] serializedMessage = bpMock.createImmutableMessage(100000l, "some-payload".getBytes(Charsets.UTF_8))
byte[] serializedMessage = bpMock.createImmutableMessage(100000l,
"some-payload".getBytes(StandardCharsets.UTF_8))
.getSerializedMessage();
/* @formatter:off */
Response postMessageResponse = bpMock.onrequest()
Expand Down

0 comments on commit 1f800a6

Please sign in to comment.