Committed by
Gerrit Code Review
UT test cases for PCEP report, Label update, TE report messages and tlvs.
Change-Id: I7b22766e330c7e5936323d44e78d63fd653a6e45
Showing
20 changed files
with
479 additions
and
127 deletions
... | @@ -78,7 +78,7 @@ public final class PcepFactories { | ... | @@ -78,7 +78,7 @@ public final class PcepFactories { |
78 | factory = org.onosproject.pcepio.protocol.ver1.PcepFactoryVer1.INSTANCE; | 78 | factory = org.onosproject.pcepio.protocol.ver1.PcepFactoryVer1.INSTANCE; |
79 | break; | 79 | break; |
80 | default: | 80 | default: |
81 | - throw new IllegalArgumentException("Unknown Packet version: " + packetVersion); | 81 | + throw new PcepParseException("Unknown Packet version: " + packetVersion); |
82 | } | 82 | } |
83 | return factory.getReader().readFrom(bb); | 83 | return factory.getReader().readFrom(bb); |
84 | } | 84 | } | ... | ... |
... | @@ -27,8 +27,15 @@ import org.onosproject.pcepio.protocol.PcepError; | ... | @@ -27,8 +27,15 @@ import org.onosproject.pcepio.protocol.PcepError; |
27 | import org.onosproject.pcepio.protocol.PcepErrorMsg; | 27 | import org.onosproject.pcepio.protocol.PcepErrorMsg; |
28 | import org.onosproject.pcepio.protocol.PcepErrorObject; | 28 | import org.onosproject.pcepio.protocol.PcepErrorObject; |
29 | import org.onosproject.pcepio.protocol.PcepFactory; | 29 | import org.onosproject.pcepio.protocol.PcepFactory; |
30 | +import org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency; | ||
30 | import org.onosproject.pcepio.protocol.PcepInitiateMsg; | 31 | import org.onosproject.pcepio.protocol.PcepInitiateMsg; |
32 | +import org.onosproject.pcepio.protocol.PcepIroObject; | ||
31 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; | 33 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; |
34 | +import org.onosproject.pcepio.protocol.PcepLabelObject; | ||
35 | +import org.onosproject.pcepio.protocol.PcepLabelRangeObject; | ||
36 | +import org.onosproject.pcepio.protocol.PcepLabelRangeResvMsg; | ||
37 | +import org.onosproject.pcepio.protocol.PcepLabelUpdate; | ||
38 | +import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg; | ||
32 | import org.onosproject.pcepio.protocol.PcepLspObject; | 39 | import org.onosproject.pcepio.protocol.PcepLspObject; |
33 | import org.onosproject.pcepio.protocol.PcepLspaObject; | 40 | import org.onosproject.pcepio.protocol.PcepLspaObject; |
34 | import org.onosproject.pcepio.protocol.PcepMessage; | 41 | import org.onosproject.pcepio.protocol.PcepMessage; |
... | @@ -37,7 +44,10 @@ import org.onosproject.pcepio.protocol.PcepMetricObject; | ... | @@ -37,7 +44,10 @@ import org.onosproject.pcepio.protocol.PcepMetricObject; |
37 | import org.onosproject.pcepio.protocol.PcepMsgPath; | 44 | import org.onosproject.pcepio.protocol.PcepMsgPath; |
38 | import org.onosproject.pcepio.protocol.PcepOpenMsg; | 45 | import org.onosproject.pcepio.protocol.PcepOpenMsg; |
39 | import org.onosproject.pcepio.protocol.PcepOpenObject; | 46 | import org.onosproject.pcepio.protocol.PcepOpenObject; |
47 | +import org.onosproject.pcepio.protocol.PcepReportMsg; | ||
48 | +import org.onosproject.pcepio.protocol.PcepRroObject; | ||
40 | import org.onosproject.pcepio.protocol.PcepSrpObject; | 49 | import org.onosproject.pcepio.protocol.PcepSrpObject; |
50 | +import org.onosproject.pcepio.protocol.PcepStateReport; | ||
41 | import org.onosproject.pcepio.protocol.PcepUpdateMsg; | 51 | import org.onosproject.pcepio.protocol.PcepUpdateMsg; |
42 | import org.onosproject.pcepio.protocol.PcepUpdateRequest; | 52 | import org.onosproject.pcepio.protocol.PcepUpdateRequest; |
43 | import org.onosproject.pcepio.protocol.PcepVersion; | 53 | import org.onosproject.pcepio.protocol.PcepVersion; |
... | @@ -72,9 +82,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -72,9 +82,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
72 | } | 82 | } |
73 | 83 | ||
74 | @Override | 84 | @Override |
75 | - public org.onosproject.pcepio.protocol.PcepReportMsg.Builder buildReportMsg() { | 85 | + public PcepReportMsg.Builder buildReportMsg() { |
76 | - // TODO Auto-generated method stub | 86 | + return new PcepReportMsgVer1.Builder(); |
77 | - return null; | ||
78 | } | 87 | } |
79 | 88 | ||
80 | @Override | 89 | @Override |
... | @@ -113,9 +122,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -113,9 +122,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
113 | } | 122 | } |
114 | 123 | ||
115 | @Override | 124 | @Override |
116 | - public org.onosproject.pcepio.protocol.PcepRroObject.Builder buildRroObject() { | 125 | + public PcepRroObject.Builder buildRroObject() { |
117 | - // TODO Auto-generated method stub | 126 | + return new PcepRroObjectVer1.Builder(); |
118 | - return null; | ||
119 | } | 127 | } |
120 | 128 | ||
121 | @Override | 129 | @Override |
... | @@ -124,9 +132,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -124,9 +132,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
124 | } | 132 | } |
125 | 133 | ||
126 | @Override | 134 | @Override |
127 | - public org.onosproject.pcepio.protocol.PcepIroObject.Builder buildIroObject() { | 135 | + public PcepIroObject.Builder buildIroObject() { |
128 | - // TODO Auto-generated method stub | 136 | + return new PcepIroObjectVer1.Builder(); |
129 | - return null; | ||
130 | } | 137 | } |
131 | 138 | ||
132 | @Override | 139 | @Override |
... | @@ -145,9 +152,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -145,9 +152,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
145 | } | 152 | } |
146 | 153 | ||
147 | @Override | 154 | @Override |
148 | - public org.onosproject.pcepio.protocol.PcepStateReport.Builder buildPcepStateReport() { | 155 | + public PcepStateReport.Builder buildPcepStateReport() { |
149 | - // TODO Auto-generated method stub | 156 | + return new PcepStateReportVer1.Builder(); |
150 | - return null; | ||
151 | } | 157 | } |
152 | 158 | ||
153 | @Override | 159 | @Override |
... | @@ -166,21 +172,18 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -166,21 +172,18 @@ public class PcepFactoryVer1 implements PcepFactory { |
166 | } | 172 | } |
167 | 173 | ||
168 | @Override | 174 | @Override |
169 | - public org.onosproject.pcepio.protocol.PcepLabelUpdateMsg.Builder buildPcepLabelUpdateMsg() { | 175 | + public PcepLabelUpdateMsg.Builder buildPcepLabelUpdateMsg() { |
170 | - // TODO Auto-generated method stub | 176 | + return new PcepLabelUpdateMsgVer1.Builder(); |
171 | - return null; | ||
172 | } | 177 | } |
173 | 178 | ||
174 | @Override | 179 | @Override |
175 | - public org.onosproject.pcepio.protocol.PcepLabelUpdate.Builder buildPcepLabelUpdateObject() { | 180 | + public PcepLabelUpdate.Builder buildPcepLabelUpdateObject() { |
176 | - // TODO Auto-generated method stub | 181 | + return new PcepLabelUpdateVer1.Builder(); |
177 | - return null; | ||
178 | } | 182 | } |
179 | 183 | ||
180 | @Override | 184 | @Override |
181 | - public org.onosproject.pcepio.protocol.PcepLabelObject.Builder buildLabelObject() { | 185 | + public PcepLabelObject.Builder buildLabelObject() { |
182 | - // TODO Auto-generated method stub | 186 | + return new PcepLabelObjectVer1.Builder(); |
183 | - return null; | ||
184 | } | 187 | } |
185 | 188 | ||
186 | @Override | 189 | @Override |
... | @@ -194,9 +197,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -194,9 +197,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
194 | } | 197 | } |
195 | 198 | ||
196 | @Override | 199 | @Override |
197 | - public org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency.Builder buildFecIpv4Adjacency() { | 200 | + public PcepFecObjectIPv4Adjacency.Builder buildFecIpv4Adjacency() { |
198 | - // TODO Auto-generated method stub | 201 | + return new PcepFecObjectIPv4AdjacencyVer1.Builder(); |
199 | - return null; | ||
200 | } | 202 | } |
201 | 203 | ||
202 | @Override | 204 | @Override |
... | @@ -210,15 +212,13 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -210,15 +212,13 @@ public class PcepFactoryVer1 implements PcepFactory { |
210 | } | 212 | } |
211 | 213 | ||
212 | @Override | 214 | @Override |
213 | - public org.onosproject.pcepio.protocol.PcepLabelRangeObject.Builder buildPcepLabelRangeObject() { | 215 | + public PcepLabelRangeObject.Builder buildPcepLabelRangeObject() { |
214 | - // TODO Auto-generated method stub | 216 | + return new PcepLabelRangeObjectVer1.Builder(); |
215 | - return null; | ||
216 | } | 217 | } |
217 | 218 | ||
218 | @Override | 219 | @Override |
219 | - public org.onosproject.pcepio.protocol.PcepLabelRangeResvMsg.Builder buildPcepLabelRangeResvMsg() { | 220 | + public PcepLabelRangeResvMsg.Builder buildPcepLabelRangeResvMsg() { |
220 | - // TODO Auto-generated method stub | 221 | + return new PcepLabelRangeResvMsgVer1.Builder(); |
221 | - return null; | ||
222 | } | 222 | } |
223 | 223 | ||
224 | } | 224 | } | ... | ... |
... | @@ -42,6 +42,7 @@ public abstract class PcepMessageVer1 { | ... | @@ -42,6 +42,7 @@ public abstract class PcepMessageVer1 { |
42 | static final byte CLOSE_MSG_TYPE = 0x7; | 42 | static final byte CLOSE_MSG_TYPE = 0x7; |
43 | static final byte ERROR_MSG_TYPE = 0x6; | 43 | static final byte ERROR_MSG_TYPE = 0x6; |
44 | static final byte LABEL_UPDATE_MSG_TYPE = 0xD; | 44 | static final byte LABEL_UPDATE_MSG_TYPE = 0xD; |
45 | + static final byte LABEL_RANGE_RESV_MSG_TYPE = 0xF; | ||
45 | public static final int SHIFT_FLAG = 5; | 46 | public static final int SHIFT_FLAG = 5; |
46 | static final int MINIMUM_COMMON_HEADER_LENGTH = 4; | 47 | static final int MINIMUM_COMMON_HEADER_LENGTH = 4; |
47 | 48 | ||
... | @@ -86,7 +87,7 @@ public abstract class PcepMessageVer1 { | ... | @@ -86,7 +87,7 @@ public abstract class PcepMessageVer1 { |
86 | log.debug("REPORT MESSAGE is received"); | 87 | log.debug("REPORT MESSAGE is received"); |
87 | // message type value 10 means it is Report message | 88 | // message type value 10 means it is Report message |
88 | // return | 89 | // return |
89 | - // TODO: Read Report message from channel buffer. | 90 | + return PcepReportMsgVer1.READER.readFrom(cb.readBytes(length)); |
90 | case UPDATE_MSG_TYPE: | 91 | case UPDATE_MSG_TYPE: |
91 | log.debug("UPDATE MESSAGE is received"); | 92 | log.debug("UPDATE MESSAGE is received"); |
92 | //message type value 11 means it is Update message | 93 | //message type value 11 means it is Update message |
... | @@ -103,12 +104,17 @@ public abstract class PcepMessageVer1 { | ... | @@ -103,12 +104,17 @@ public abstract class PcepMessageVer1 { |
103 | log.debug("TE REPORT MESSAGE is received"); | 104 | log.debug("TE REPORT MESSAGE is received"); |
104 | // message type value 14 means it is TE REPORT message | 105 | // message type value 14 means it is TE REPORT message |
105 | // return | 106 | // return |
106 | - // TODO: Read TE Report message from channel buffer. | 107 | + return PcepTEReportMsgVer1.READER.readFrom(cb.readBytes(length)); |
107 | case LABEL_UPDATE_MSG_TYPE: | 108 | case LABEL_UPDATE_MSG_TYPE: |
108 | log.debug("LABEL UPDATE MESSAGE is received"); | 109 | log.debug("LABEL UPDATE MESSAGE is received"); |
109 | // message type value 13 means it is LABEL UPDATE message | 110 | // message type value 13 means it is LABEL UPDATE message |
110 | // return | 111 | // return |
111 | - // TODO: Read Label update message from channel buffer. | 112 | + return PcepLabelUpdateMsgVer1.READER.readFrom(cb.readBytes(length)); |
113 | + case LABEL_RANGE_RESV_MSG_TYPE: | ||
114 | + log.debug("LABEL RANGE RESERVE MESSAGE is received"); | ||
115 | + // message type value 15 means it is LABEL RANGE RESERVE message | ||
116 | + // return | ||
117 | + return PcepLabelRangeResvMsgVer1.READER.readFrom(cb.readBytes(length)); | ||
112 | default: | 118 | default: |
113 | throw new PcepParseException("ERROR: UNKNOWN MESSAGE is received. Msg Type: " + type); | 119 | throw new PcepParseException("ERROR: UNKNOWN MESSAGE is received. Msg Type: " + type); |
114 | } | 120 | } | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import com.google.common.testing.EqualsTester; | ||
19 | + | ||
20 | +import org.junit.Test; | ||
21 | +import org.onosproject.pcepio.types.IPv4SubObject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Test of the IPv4SubObject. | ||
25 | + */ | ||
26 | +public class IPv4SubObjectTest { | ||
27 | + | ||
28 | + private final IPv4SubObject subObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); | ||
29 | + private final IPv4SubObject sameAsSubObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); | ||
30 | + private final IPv4SubObject subObj2 = IPv4SubObject.of(3, (byte) 16, (byte) 0); | ||
31 | + | ||
32 | + @Test | ||
33 | + public void basics() { | ||
34 | + new EqualsTester() | ||
35 | + .addEqualityGroup(subObj1, sameAsSubObj1) | ||
36 | + .addEqualityGroup(subObj2) | ||
37 | + .testEquals(); | ||
38 | + } | ||
39 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import com.google.common.testing.EqualsTester; | ||
19 | + | ||
20 | +import org.junit.Test; | ||
21 | +import org.onosproject.pcepio.types.IPv6SubObject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Test of the IPv6SubObject. | ||
25 | + */ | ||
26 | +public class IPv6SubObjectTest { | ||
27 | + | ||
28 | + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, | ||
29 | + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; | ||
30 | + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, | ||
31 | + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; | ||
32 | + | ||
33 | + private final IPv6SubObject subObj1 = IPv6SubObject.of(b1); | ||
34 | + private final IPv6SubObject sameAsSubObj1 = IPv6SubObject.of(b1); | ||
35 | + private final IPv6SubObject subObj2 = IPv6SubObject.of(b2); | ||
36 | + | ||
37 | + @Test | ||
38 | + public void basics() { | ||
39 | + new EqualsTester().addEqualityGroup(subObj1, sameAsSubObj1).addEqualityGroup(subObj2).testEquals(); | ||
40 | + } | ||
41 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import com.google.common.testing.EqualsTester; | ||
19 | + | ||
20 | +import org.junit.Test; | ||
21 | +import org.onosproject.pcepio.types.LabelSubObject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Test of the LabelSubObject. | ||
25 | + */ | ||
26 | +public class LabelSubObjectTest { | ||
27 | + | ||
28 | + private final LabelSubObject subObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); | ||
29 | + private final LabelSubObject sameAsSubObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); | ||
30 | + private final LabelSubObject subObj2 = LabelSubObject.of((byte) 0, (byte) 1, 30); | ||
31 | + | ||
32 | + @Test | ||
33 | + public void basics() { | ||
34 | + new EqualsTester() | ||
35 | + .addEqualityGroup(subObj1, sameAsSubObj1) | ||
36 | + .addEqualityGroup(subObj2) | ||
37 | + .testEquals(); | ||
38 | + } | ||
39 | +} |
1 | +/* * Copyright 2015 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (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 * * 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.onosproject.pcepio; import com.google.common.testing.EqualsTester; import org.junit.Test; import java.util.LinkedList; import org.onosproject.pcepio.types.LocalTENodeDescriptorsTLV;import org.onosproject.pcepio.types.AutonomousSystemTlv;import org.onosproject.pcepio.types.BGPLSidentifierTlv;import org.onosproject.pcepio.types.PcepValueType; /** * Test of the LocalTENodeDescriptorsTlv. */public class LocalTENodeDescriptorsTlvTest { private final AutonomousSystemTlv baAutoSysTlvRawValue1 = new AutonomousSystemTlv(1); private final BGPLSidentifierTlv baBgplsIdRawValue1 = new BGPLSidentifierTlv(1); private final AutonomousSystemTlv baAutoSysTlvRawValue2 = new AutonomousSystemTlv(2); private final BGPLSidentifierTlv baBgplsIdRawValue2 = new BGPLSidentifierTlv(2); private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs1 = new LinkedList<PcepValueType>(); private final boolean a = llNodeDescriptorSubTLVs1.add(baAutoSysTlvRawValue1); private final boolean b = llNodeDescriptorSubTLVs1.add(baBgplsIdRawValue1); private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs2 = new LinkedList<PcepValueType>(); private final boolean c = llNodeDescriptorSubTLVs2.add(baAutoSysTlvRawValue2); private final boolean d = llNodeDescriptorSubTLVs2.add(baBgplsIdRawValue2); private final LocalTENodeDescriptorsTLV tlv1 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs1); private final LocalTENodeDescriptorsTLV sameAstlv1 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs1); private final LocalTENodeDescriptorsTLV tlv2 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs2); @Test public void basics() { new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); }} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -17,9 +17,7 @@ package org.onosproject.pcepio; | ... | @@ -17,9 +17,7 @@ package org.onosproject.pcepio; |
17 | 17 | ||
18 | import org.jboss.netty.buffer.ChannelBuffer; | 18 | import org.jboss.netty.buffer.ChannelBuffer; |
19 | import org.jboss.netty.buffer.ChannelBuffers; | 19 | import org.jboss.netty.buffer.ChannelBuffers; |
20 | -import org.junit.After; | ||
21 | import org.junit.Assert; | 20 | import org.junit.Assert; |
22 | -import org.junit.Before; | ||
23 | import org.junit.Test; | 21 | import org.junit.Test; |
24 | import org.onosproject.pcepio.exceptions.PcepParseException; | 22 | import org.onosproject.pcepio.exceptions.PcepParseException; |
25 | import org.onosproject.pcepio.protocol.PcepFactories; | 23 | import org.onosproject.pcepio.protocol.PcepFactories; |
... | @@ -27,58 +25,36 @@ import org.onosproject.pcepio.protocol.PcepMessage; | ... | @@ -27,58 +25,36 @@ import org.onosproject.pcepio.protocol.PcepMessage; |
27 | import org.onosproject.pcepio.protocol.PcepMessageReader; | 25 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
28 | import org.onosproject.pcepio.protocol.PcepCloseMsg; | 26 | import org.onosproject.pcepio.protocol.PcepCloseMsg; |
29 | 27 | ||
30 | -import java.util.Arrays; | ||
31 | - | ||
32 | -import org.slf4j.Logger; | ||
33 | -import org.slf4j.LoggerFactory; | ||
34 | - | ||
35 | public class PcepCloseMsgTest { | 28 | public class PcepCloseMsgTest { |
36 | - protected static final Logger log = LoggerFactory.getLogger(PcepCloseMsgTest.class); | ||
37 | - | ||
38 | - @Before | ||
39 | - public void startUp() { | ||
40 | - } | ||
41 | - | ||
42 | - @After | ||
43 | - public void tearDown() { | ||
44 | - | ||
45 | - } | ||
46 | 29 | ||
30 | + /** | ||
31 | + * Common header, reason to close. | ||
32 | + * | ||
33 | + * @throws PcepParseException while parsing the PCEP message. | ||
34 | + */ | ||
47 | @Test | 35 | @Test |
48 | public void closeMessageTest1() throws PcepParseException { | 36 | public void closeMessageTest1() throws PcepParseException { |
49 | - byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, /* common header */ | 37 | + |
38 | + byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, | ||
50 | 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 }; | 39 | 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 }; |
51 | 40 | ||
52 | - byte[] testCloseMsg = {0}; | 41 | + byte[] testCloseMsg = {0 }; |
53 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 42 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
54 | buffer.writeBytes(closeMsg); | 43 | buffer.writeBytes(closeMsg); |
55 | 44 | ||
56 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 45 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
57 | PcepMessage message = null; | 46 | PcepMessage message = null; |
58 | - try { | ||
59 | - message = reader.readFrom(buffer); | ||
60 | - } catch (PcepParseException e) { | ||
61 | - e.printStackTrace(); | ||
62 | - } | ||
63 | 47 | ||
64 | - if (message instanceof PcepCloseMsg) { | 48 | + message = reader.readFrom(buffer); |
65 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 49 | + Assert.assertTrue("PcepMessage is not instance of PcepCloseMsg", message instanceof PcepCloseMsg); |
66 | - message.writeTo(buf); | 50 | + |
67 | - testCloseMsg = buf.array(); | 51 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
52 | + message.writeTo(buf); | ||
53 | + testCloseMsg = buf.array(); | ||
68 | 54 | ||
69 | - int iReadLen = buf.writerIndex() - 0; | 55 | + int readLen = buf.writerIndex() - 0; |
70 | - testCloseMsg = new byte[iReadLen]; | 56 | + testCloseMsg = new byte[readLen]; |
71 | - buf.readBytes(testCloseMsg, 0, iReadLen); | 57 | + buf.readBytes(testCloseMsg, 0, readLen); |
72 | - if (Arrays.equals(closeMsg, testCloseMsg)) { | 58 | + Assert.assertArrayEquals("PcTERpt messages are not equal", closeMsg, testCloseMsg); |
73 | - Assert.assertArrayEquals(closeMsg, testCloseMsg); | ||
74 | - log.debug("CloseMsg are equal :" + closeMsg); | ||
75 | - } else { | ||
76 | - Assert.fail("test case failed"); | ||
77 | - log.debug("not equal"); | ||
78 | - } | ||
79 | - } else { | ||
80 | - Assert.fail("test case failed"); | ||
81 | - log.debug("not equal"); | ||
82 | - } | ||
83 | } | 59 | } |
84 | } | 60 | } | ... | ... |
... | @@ -15,72 +15,46 @@ | ... | @@ -15,72 +15,46 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.pcepio; | 16 | package org.onosproject.pcepio; |
17 | 17 | ||
18 | -import java.util.Arrays; | ||
19 | - | ||
20 | import org.jboss.netty.buffer.ChannelBuffer; | 18 | import org.jboss.netty.buffer.ChannelBuffer; |
21 | import org.jboss.netty.buffer.ChannelBuffers; | 19 | import org.jboss.netty.buffer.ChannelBuffers; |
22 | -import org.junit.After; | ||
23 | import org.junit.Assert; | 20 | import org.junit.Assert; |
24 | -import org.junit.Before; | ||
25 | import org.junit.Test; | 21 | import org.junit.Test; |
26 | import org.onosproject.pcepio.exceptions.PcepParseException; | 22 | import org.onosproject.pcepio.exceptions.PcepParseException; |
27 | import org.onosproject.pcepio.protocol.PcepFactories; | 23 | import org.onosproject.pcepio.protocol.PcepFactories; |
28 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; | 24 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; |
29 | import org.onosproject.pcepio.protocol.PcepMessage; | 25 | import org.onosproject.pcepio.protocol.PcepMessage; |
30 | import org.onosproject.pcepio.protocol.PcepMessageReader; | 26 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
31 | -import org.slf4j.Logger; | ||
32 | -import org.slf4j.LoggerFactory; | ||
33 | 27 | ||
34 | public class PcepKeepaliveMsgTest { | 28 | public class PcepKeepaliveMsgTest { |
35 | 29 | ||
36 | - protected static final Logger log = LoggerFactory.getLogger(PcepKeepaliveMsgTest.class); | 30 | + /** |
37 | - | 31 | + * Common header for keep alive message. |
38 | - @Before | 32 | + * |
39 | - public void startUp() { | 33 | + * @throws PcepParseException while parsing the PCEP message. |
40 | - | 34 | + */ |
41 | - } | ||
42 | - | ||
43 | - @After | ||
44 | - public void tearDown() { | ||
45 | - | ||
46 | - } | ||
47 | - | ||
48 | @Test | 35 | @Test |
49 | public void keepaliveMessageTest1() throws PcepParseException { | 36 | public void keepaliveMessageTest1() throws PcepParseException { |
50 | 37 | ||
51 | byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 }; | 38 | byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 }; |
52 | 39 | ||
53 | - byte[] testKeepaliveMsg = {0}; | 40 | + byte[] testKeepaliveMsg = {0 }; |
54 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 41 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
55 | buffer.writeBytes(keepaliveMsg); | 42 | buffer.writeBytes(keepaliveMsg); |
56 | 43 | ||
57 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 44 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
58 | PcepMessage message = null; | 45 | PcepMessage message = null; |
59 | - try { | ||
60 | - message = reader.readFrom(buffer); | ||
61 | - } catch (PcepParseException e) { | ||
62 | - e.printStackTrace(); | ||
63 | - } | ||
64 | 46 | ||
65 | - if (message instanceof PcepKeepaliveMsg) { | 47 | + message = reader.readFrom(buffer); |
66 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 48 | + Assert.assertTrue("PcepMessage is not instance of PcepKeepaliveMsg", message instanceof PcepKeepaliveMsg); |
67 | - message.writeTo(buf); | 49 | + |
68 | - testKeepaliveMsg = buf.array(); | 50 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
51 | + message.writeTo(buf); | ||
52 | + testKeepaliveMsg = buf.array(); | ||
69 | 53 | ||
70 | - int iReadLen = buf.writerIndex() - 0; | 54 | + int iReadLen = buf.writerIndex() - 0; |
71 | - testKeepaliveMsg = new byte[iReadLen]; | 55 | + testKeepaliveMsg = new byte[iReadLen]; |
72 | - buf.readBytes(testKeepaliveMsg, 0, iReadLen); | 56 | + buf.readBytes(testKeepaliveMsg, 0, iReadLen); |
73 | 57 | ||
74 | - if (Arrays.equals(keepaliveMsg, testKeepaliveMsg)) { | 58 | + Assert.assertArrayEquals("PcTERpt messages are not equal", keepaliveMsg, testKeepaliveMsg); |
75 | - Assert.assertArrayEquals(keepaliveMsg, testKeepaliveMsg); | ||
76 | - log.debug("keepaliveMsg are equal :" + keepaliveMsg); | ||
77 | - } else { | ||
78 | - Assert.fail("test case failed"); | ||
79 | - log.debug("not equal"); | ||
80 | - } | ||
81 | - } else { | ||
82 | - Assert.fail("test case failed"); | ||
83 | - log.debug("not equal"); | ||
84 | - } | ||
85 | } | 59 | } |
86 | } | 60 | } | ... | ... |
This diff is collapsed. Click to expand it.
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.PcepNaiIpv4NodeId; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class PcepNaiIpv4NodeIdTest { | ||
24 | + | ||
25 | + private final PcepNaiIpv4NodeId tlv1 = PcepNaiIpv4NodeId.of(1); | ||
26 | + private final PcepNaiIpv4NodeId tlv2 = PcepNaiIpv4NodeId.of(1); | ||
27 | + private final PcepNaiIpv4NodeId tlv3 = PcepNaiIpv4NodeId.of(3); | ||
28 | + | ||
29 | + @Test | ||
30 | + public void basics() { | ||
31 | + new EqualsTester() | ||
32 | + .addEqualityGroup(tlv1, tlv2) | ||
33 | + .addEqualityGroup(tlv3) | ||
34 | + .testEquals(); | ||
35 | + } | ||
36 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.PcepNaiIpv6Adjacency; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class PcepNaiIpv6AdjacencyTest { | ||
24 | + private final byte[] localIpv6Addr1 = {(byte) 0x01010101 }; | ||
25 | + private final byte[] remoteIpv6Addr1 = {(byte) 0x02020202 }; | ||
26 | + private final byte[] localIpv6Addr2 = {(byte) 0x01010101 }; | ||
27 | + private final byte[] remoteIpv6Addr2 = {(byte) 0x02020202 }; | ||
28 | + private final byte[] localIpv6Addr3 = {(byte) 0x05050505 }; | ||
29 | + private final byte[] remoteIpv6Addr3 = {(byte) 0x06060606 }; | ||
30 | + | ||
31 | + private final PcepNaiIpv6Adjacency tlv1 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); | ||
32 | + private final PcepNaiIpv6Adjacency tlv2 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); | ||
33 | + private final PcepNaiIpv6Adjacency tlv3 = PcepNaiIpv6Adjacency.of(localIpv6Addr3, remoteIpv6Addr3); | ||
34 | + | ||
35 | + @Test | ||
36 | + public void basics() { | ||
37 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
38 | + } | ||
39 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.PcepNaiUnnumberedAdjacencyIpv4; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class PcepNaiUnnumberedAdjacencyIpv4Test { | ||
24 | + | ||
25 | + private final int localNodeId1 = 1; | ||
26 | + private final int localInterfaceId1 = 1; | ||
27 | + private final int remoteNodeId1 = 1; | ||
28 | + private final int remoteInterfaceId1 = 1; | ||
29 | + private final PcepNaiUnnumberedAdjacencyIpv4 tlv1 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId1, | ||
30 | + localInterfaceId1, remoteNodeId1, remoteInterfaceId1); | ||
31 | + | ||
32 | + private final int localNodeId2 = 1; | ||
33 | + private final int localInterfaceId2 = 1; | ||
34 | + private final int remoteNodeId2 = 1; | ||
35 | + private final int remoteInterfaceId2 = 1; | ||
36 | + private final PcepNaiUnnumberedAdjacencyIpv4 tlv2 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId2, | ||
37 | + localInterfaceId2, remoteNodeId2, remoteInterfaceId2); | ||
38 | + | ||
39 | + private final int localNodeId3 = 2; | ||
40 | + private final int localInterfaceId3 = 2; | ||
41 | + private final int remoteNodeId3 = 2; | ||
42 | + private final int remoteInterfaceId3 = 2; | ||
43 | + | ||
44 | + private final PcepNaiUnnumberedAdjacencyIpv4 tlv3 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId3, | ||
45 | + localInterfaceId3, remoteNodeId3, remoteInterfaceId3); | ||
46 | + | ||
47 | + @Test | ||
48 | + public void basics() { | ||
49 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
50 | + } | ||
51 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.protocol.PcepNai; | ||
20 | +import org.onosproject.pcepio.types.SrEroSubObject; | ||
21 | + | ||
22 | +import com.google.common.testing.EqualsTester; | ||
23 | + | ||
24 | +public class SrEroSubObjectTest { | ||
25 | + | ||
26 | + private final boolean bFFlag = false; | ||
27 | + private final boolean bSFlag = false; | ||
28 | + private final boolean bCFlag = false; | ||
29 | + private final boolean bMFlag = false; | ||
30 | + private final byte st = 1; | ||
31 | + private final int sID = 1; | ||
32 | + private final PcepNai nai = null; | ||
33 | + | ||
34 | + private final SrEroSubObject tlv1 = SrEroSubObject.of(st, bFFlag, bSFlag, bCFlag, bMFlag, sID, nai); | ||
35 | + | ||
36 | + private final boolean bFFlag1 = false; | ||
37 | + private final boolean bSFlag1 = false; | ||
38 | + private final boolean bCFlag1 = false; | ||
39 | + private final boolean bMFlag1 = false; | ||
40 | + private final byte st1 = 1; | ||
41 | + private final int sID1 = 1; | ||
42 | + private final PcepNai nai1 = null; | ||
43 | + | ||
44 | + private final SrEroSubObject tlv2 = SrEroSubObject.of(st1, bFFlag1, bSFlag1, bCFlag1, bMFlag1, sID1, nai1); | ||
45 | + | ||
46 | + private final boolean bFFlag2 = true; | ||
47 | + private final boolean bSFlag2 = true; | ||
48 | + private final boolean bCFlag2 = true; | ||
49 | + private final boolean bMFlag2 = true; | ||
50 | + private final byte st2 = 2; | ||
51 | + private final int sID2 = 2; | ||
52 | + private final PcepNai nai2 = null; | ||
53 | + | ||
54 | + private final SrEroSubObject tlv3 = SrEroSubObject.of(st2, bFFlag2, bSFlag2, bCFlag2, bMFlag2, sID2, nai2); | ||
55 | + | ||
56 | + @Test | ||
57 | + public void basics() { | ||
58 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
59 | + } | ||
60 | + | ||
61 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.StatefulIPv4LspIdentidiersTlv; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class StatefulIPv4LspIdentidiersTlvTest { | ||
24 | + | ||
25 | + private final int ipv4IngressAddress = 1; | ||
26 | + private final short lspId = 1; | ||
27 | + private final short tunnelId = 1; | ||
28 | + private final int extendedTunnelId = 1; | ||
29 | + private final int ipv4EgressAddress = 1; | ||
30 | + | ||
31 | + private final StatefulIPv4LspIdentidiersTlv tlv1 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress, lspId, | ||
32 | + tunnelId, extendedTunnelId, ipv4EgressAddress); | ||
33 | + | ||
34 | + private final int ipv4IngressAddress1 = 1; | ||
35 | + private final short lspId1 = 1; | ||
36 | + private final short tunnelId1 = 1; | ||
37 | + private final int extendedTunnelId1 = 1; | ||
38 | + private final int ipv4EgressAddress1 = 1; | ||
39 | + | ||
40 | + private final StatefulIPv4LspIdentidiersTlv tlv2 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress1, lspId1, | ||
41 | + tunnelId1, extendedTunnelId1, ipv4EgressAddress1); | ||
42 | + | ||
43 | + private final int ipv4IngressAddress2 = 2; | ||
44 | + private final short lspId2 = 2; | ||
45 | + private final short tunnelId2 = 2; | ||
46 | + private final int extendedTunnelId2 = 2; | ||
47 | + private final int ipv4EgressAddress2 = 2; | ||
48 | + | ||
49 | + private final StatefulIPv4LspIdentidiersTlv tlv3 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress2, lspId2, | ||
50 | + tunnelId2, extendedTunnelId2, ipv4EgressAddress2); | ||
51 | + | ||
52 | + @Test | ||
53 | + public void basics() { | ||
54 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
55 | + | ||
56 | + } | ||
57 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.StatefulLspErrorCodeTlv; | ||
20 | +import com.google.common.testing.EqualsTester; | ||
21 | + | ||
22 | +public class StatefulLspErrorCodeTlvTest { | ||
23 | + | ||
24 | + private final StatefulLspErrorCodeTlv tlv1 = StatefulLspErrorCodeTlv.of(1); | ||
25 | + private final StatefulLspErrorCodeTlv tlv2 = StatefulLspErrorCodeTlv.of(1); | ||
26 | + private final StatefulLspErrorCodeTlv tlv3 = StatefulLspErrorCodeTlv.of(2); | ||
27 | + | ||
28 | + @Test | ||
29 | + public void basics() { | ||
30 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
31 | + } | ||
32 | +} |
... | @@ -25,17 +25,17 @@ import com.google.common.testing.EqualsTester; | ... | @@ -25,17 +25,17 @@ import com.google.common.testing.EqualsTester; |
25 | */ | 25 | */ |
26 | public class SymbolicPathNameTlvTest { | 26 | public class SymbolicPathNameTlvTest { |
27 | 27 | ||
28 | - byte[] value1 = {0x41 }; | 28 | + private final byte[] value1 = {0x41 }; |
29 | - Short length1 = new Short((short) 2); | 29 | + private final Short length1 = new Short((short) 2); |
30 | - final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1); | 30 | + private final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1); |
31 | 31 | ||
32 | - byte[] value2 = {0x41 }; | 32 | + private final byte[] value2 = {0x41 }; |
33 | - Short length2 = new Short((short) 2); | 33 | + private final Short length2 = new Short((short) 2); |
34 | - final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2); | 34 | + private final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2); |
35 | 35 | ||
36 | - byte[] value3 = {0x41, 0x43 }; | 36 | + private final byte[] value3 = {0x41, 0x43 }; |
37 | - Short length3 = new Short((short) 3); | 37 | + private final Short length3 = new Short((short) 3); |
38 | - final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3); | 38 | + private final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3); |
39 | 39 | ||
40 | @Test | 40 | @Test |
41 | public void basics() { | 41 | public void basics() { | ... | ... |
-
Please register or login to post a comment