Debian Codegraph @

proton-j/src/test/java/org/apache/qpid/proton/amqp/messaging/PropertiesTest.java

raw
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.qpid.proton.amqp.messaging;
18
19 import static org.junit.Assert.assertEquals;
20
21 import java.util.Date;
22
23 import org.apache.qpid.proton.amqp.Binary;
24 import org.apache.qpid.proton.amqp.Symbol;
25 import org.apache.qpid.proton.amqp.UnsignedInteger;
26 import org.junit.Test;
27
28 /**
29 *
30 */
31 public class PropertiesTest {
32
33 @Test
34 public void testCopy() {
35 Properties original = new Properties();
36
37 original.setAbsoluteExpiryTime(new Date(System.currentTimeMillis()));
38 original.setContentEncoding(Symbol.valueOf("utf-8"));
39 original.setContentType(Symbol.valueOf("test/plain"));
40 original.setCorrelationId("1");
41 original.setCreationTime(new Date(System.currentTimeMillis()));
42 original.setGroupId("group-1");
43 original.setGroupSequence(UnsignedInteger.MAX_VALUE);
44 original.setMessageId("ID:1");
45 original.setReplyTo("queue");
46 original.setReplyToGroupId("3");
47 original.setSubject("subject");
48 original.setTo("to-queue");
49 original.setUserId(new Binary(new byte[1]));
50
51 Properties copy = new Properties(original);
52
53 assertEquals(original.getAbsoluteExpiryTime(), copy.getAbsoluteExpiryTime());
54 assertEquals(original.getContentEncoding(), copy.getContentEncoding());
55 assertEquals(original.getContentType(), copy.getContentType());
56 assertEquals(original.getCorrelationId(), copy.getCorrelationId());
57 assertEquals(original.getCreationTime(), copy.getCreationTime());
58 assertEquals(original.getGroupId(), copy.getGroupId());
59 assertEquals(original.getGroupSequence(), copy.getGroupSequence());
60 assertEquals(original.getMessageId(), copy.getMessageId());
61 assertEquals(original.getReplyTo(), copy.getReplyTo());
62 assertEquals(original.getReplyToGroupId(), copy.getReplyToGroupId());
63 assertEquals(original.getSubject(), copy.getSubject());
64 assertEquals(original.getTo(), copy.getTo());
65 assertEquals(original.getUserId(), copy.getUserId());
66 }
67
68 }