Skip to content

Commit

Permalink
Removed author info and formatted.
Browse files Browse the repository at this point in the history
  • Loading branch information
shroman committed May 4, 2017
1 parent 8feb88d commit d72addf
Showing 1 changed file with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,33 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.rocketmq.common;

import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageDecoder;
import org.junit.Test;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageDecoder;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

/**
* Created by liuzhendong on 16/12/21.
*/
public class MessageEncodeDecodeTest {


@Test
public void testEncodeDecodeSingle() throws Exception{
public void testEncodeDecodeSingle() throws Exception {
Message message = new Message("topic", "body".getBytes());
message.setFlag(12);
message.putUserProperty("key","value");
message.putUserProperty("key", "value");
byte[] bytes = MessageDecoder.encodeMessage(message);
ByteBuffer buffer = ByteBuffer.allocate(bytes.length);
buffer.put(bytes);
Expand All @@ -59,7 +53,7 @@ public void testEncodeDecodeList() throws Exception {
message.putUserProperty("key", "value" + i);
messages.add(message);
}
byte[] bytes = MessageDecoder.encodeMessages(messages);
byte[] bytes = MessageDecoder.encodeMessages(messages);

ByteBuffer buffer = ByteBuffer.allocate(bytes.length);
buffer.put(bytes);
Expand Down

0 comments on commit d72addf

Please sign in to comment.