Committed by
Gerrit Code Review
PcIntiateMsg UT updated for adding javadoc, remove log and if check
Change-Id: Ie15db6bd2af729091779b186f1c84e2b411ab058
Showing
2 changed files
with
662 additions
and
1019 deletions
... | @@ -15,13 +15,9 @@ | ... | @@ -15,13 +15,9 @@ |
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; |
... | @@ -35,16 +31,10 @@ public class PcepInitiateMsgTest { | ... | @@ -35,16 +31,10 @@ public class PcepInitiateMsgTest { |
35 | 31 | ||
36 | protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class); | 32 | protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class); |
37 | 33 | ||
38 | - @Before | 34 | + /** |
39 | - public void startUp() { | 35 | + * This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message. |
40 | - | 36 | + * @throws PcepParseException when message paring fails |
41 | - } | 37 | + */ |
42 | - | ||
43 | - @After | ||
44 | - public void tearDown() { | ||
45 | - | ||
46 | - } | ||
47 | - | ||
48 | @Test | 38 | @Test |
49 | public void initiateMessageTest1() throws PcepParseException { | 39 | public void initiateMessageTest1() throws PcepParseException { |
50 | 40 | ||
... | @@ -68,13 +58,12 @@ public class PcepInitiateMsgTest { | ... | @@ -68,13 +58,12 @@ public class PcepInitiateMsgTest { |
68 | 58 | ||
69 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 59 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
70 | PcepMessage message = null; | 60 | PcepMessage message = null; |
71 | - try { | 61 | + |
72 | message = reader.readFrom(buffer); | 62 | message = reader.readFrom(buffer); |
73 | - } catch (PcepParseException e) { | ||
74 | - e.printStackTrace(); | ||
75 | - } | ||
76 | 63 | ||
77 | - if (message instanceof PcepInitiateMsg) { | 64 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
65 | + (message instanceof PcepInitiateMsg)); | ||
66 | + | ||
78 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 67 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
79 | message.writeTo(buf); | 68 | message.writeTo(buf); |
80 | testInitiateCreationMsg = buf.array(); | 69 | testInitiateCreationMsg = buf.array(); |
... | @@ -83,19 +72,15 @@ public class PcepInitiateMsgTest { | ... | @@ -83,19 +72,15 @@ public class PcepInitiateMsgTest { |
83 | testInitiateCreationMsg = new byte[iReadLen]; | 72 | testInitiateCreationMsg = new byte[iReadLen]; |
84 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 73 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
85 | 74 | ||
86 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 75 | + Assert.assertArrayEquals("PCInitiate messages are not equal ", initiateCreationMsg, testInitiateCreationMsg); |
87 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 76 | + |
88 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
89 | - } else { | ||
90 | - Assert.fail("test case failed"); | ||
91 | - log.debug("not equal"); | ||
92 | - } | ||
93 | - } else { | ||
94 | - Assert.fail("test case failed"); | ||
95 | - log.debug("not equal"); | ||
96 | - } | ||
97 | } | 77 | } |
98 | 78 | ||
79 | + /** | ||
80 | + * This test case checks for srp and lsp objects in PcInitiate message. | ||
81 | + * | ||
82 | + * @throws PcepParseException when message paring fails | ||
83 | + */ | ||
99 | @Test | 84 | @Test |
100 | public void initiateMessageTest2() throws PcepParseException { | 85 | public void initiateMessageTest2() throws PcepParseException { |
101 | /* srp, lsp. | 86 | /* srp, lsp. |
... | @@ -114,13 +99,12 @@ public class PcepInitiateMsgTest { | ... | @@ -114,13 +99,12 @@ public class PcepInitiateMsgTest { |
114 | 99 | ||
115 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 100 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
116 | PcepMessage message = null; | 101 | PcepMessage message = null; |
117 | - try { | 102 | + |
118 | message = reader.readFrom(buffer); | 103 | message = reader.readFrom(buffer); |
119 | - } catch (PcepParseException e) { | ||
120 | - e.printStackTrace(); | ||
121 | - } | ||
122 | 104 | ||
123 | - if (message instanceof PcepInitiateMsg) { | 105 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
106 | + (message instanceof PcepInitiateMsg)); | ||
107 | + | ||
124 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 108 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
125 | message.writeTo(buf); | 109 | message.writeTo(buf); |
126 | testInitiateDeletionMsg = buf.array(); | 110 | testInitiateDeletionMsg = buf.array(); |
... | @@ -129,19 +113,17 @@ public class PcepInitiateMsgTest { | ... | @@ -129,19 +113,17 @@ public class PcepInitiateMsgTest { |
129 | testInitiateDeletionMsg = new byte[iReadLen]; | 113 | testInitiateDeletionMsg = new byte[iReadLen]; |
130 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 114 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
131 | 115 | ||
132 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 116 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
133 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 117 | + initiateDeletionMsg, testInitiateDeletionMsg); |
134 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
135 | - } else { | ||
136 | - Assert.fail("test case failed"); | ||
137 | - log.debug("not equal"); | ||
138 | - } | ||
139 | - } else { | ||
140 | - Assert.fail("test case failed"); | ||
141 | - log.debug("not equal"); | ||
142 | - } | ||
143 | } | 118 | } |
144 | 119 | ||
120 | + /** | ||
121 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, | ||
122 | + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects | ||
123 | + * in PcInitiate message. | ||
124 | + * | ||
125 | + * @throws PcepParseException when message paring fails | ||
126 | + */ | ||
145 | @Test | 127 | @Test |
146 | public void initiateMessageTest3() throws PcepParseException { | 128 | public void initiateMessageTest3() throws PcepParseException { |
147 | 129 | ||
... | @@ -168,13 +150,11 @@ public class PcepInitiateMsgTest { | ... | @@ -168,13 +150,11 @@ public class PcepInitiateMsgTest { |
168 | 150 | ||
169 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 151 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
170 | PcepMessage message = null; | 152 | PcepMessage message = null; |
171 | - try { | 153 | + |
172 | message = reader.readFrom(buffer); | 154 | message = reader.readFrom(buffer); |
173 | - } catch (PcepParseException e) { | ||
174 | - e.printStackTrace(); | ||
175 | - } | ||
176 | 155 | ||
177 | - if (message instanceof PcepInitiateMsg) { | 156 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
157 | + (message instanceof PcepInitiateMsg)); | ||
178 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 158 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
179 | message.writeTo(buf); | 159 | message.writeTo(buf); |
180 | testInitiateCreationMsg = buf.array(); | 160 | testInitiateCreationMsg = buf.array(); |
... | @@ -183,19 +163,16 @@ public class PcepInitiateMsgTest { | ... | @@ -183,19 +163,16 @@ public class PcepInitiateMsgTest { |
183 | testInitiateCreationMsg = new byte[iReadLen]; | 163 | testInitiateCreationMsg = new byte[iReadLen]; |
184 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 164 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
185 | 165 | ||
186 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 166 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
187 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 167 | + |
188 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
189 | - } else { | ||
190 | - Assert.fail("test case failed"); | ||
191 | - log.debug("not equal"); | ||
192 | - } | ||
193 | - } else { | ||
194 | - Assert.fail("test case failed"); | ||
195 | - log.debug("not equal"); | ||
196 | - } | ||
197 | } | 168 | } |
198 | 169 | ||
170 | + /** | ||
171 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, | ||
172 | + * StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message. | ||
173 | + * | ||
174 | + * @throws PcepParseException when message paring fails | ||
175 | + */ | ||
199 | @Test | 176 | @Test |
200 | public void initiateMessageTest4() throws PcepParseException { | 177 | public void initiateMessageTest4() throws PcepParseException { |
201 | 178 | ||
... | @@ -222,13 +199,11 @@ public class PcepInitiateMsgTest { | ... | @@ -222,13 +199,11 @@ public class PcepInitiateMsgTest { |
222 | 199 | ||
223 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 200 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
224 | PcepMessage message = null; | 201 | PcepMessage message = null; |
225 | - try { | 202 | + |
226 | message = reader.readFrom(buffer); | 203 | message = reader.readFrom(buffer); |
227 | - } catch (PcepParseException e) { | ||
228 | - e.printStackTrace(); | ||
229 | - } | ||
230 | 204 | ||
231 | - if (message instanceof PcepInitiateMsg) { | 205 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
206 | + (message instanceof PcepInitiateMsg)); | ||
232 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 207 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
233 | message.writeTo(buf); | 208 | message.writeTo(buf); |
234 | testInitiateCreationMsg = buf.array(); | 209 | testInitiateCreationMsg = buf.array(); |
... | @@ -237,19 +212,16 @@ public class PcepInitiateMsgTest { | ... | @@ -237,19 +212,16 @@ public class PcepInitiateMsgTest { |
237 | testInitiateCreationMsg = new byte[iReadLen]; | 212 | testInitiateCreationMsg = new byte[iReadLen]; |
238 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 213 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
239 | 214 | ||
240 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 215 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
241 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 216 | + initiateCreationMsg, testInitiateCreationMsg); |
242 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
243 | - } else { | ||
244 | - Assert.fail("test case failed"); | ||
245 | - log.debug("not equal"); | ||
246 | - } | ||
247 | - } else { | ||
248 | - Assert.fail("test case failed"); | ||
249 | - log.debug("not equal"); | ||
250 | - } | ||
251 | } | 217 | } |
252 | 218 | ||
219 | + /** | ||
220 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), | ||
221 | + * END-POINT, ERO objects in PcInitiate message. | ||
222 | + * | ||
223 | + * @throws PcepParseException when message paring fails | ||
224 | + */ | ||
253 | @Test | 225 | @Test |
254 | public void initiateMessageTest5() throws PcepParseException { | 226 | public void initiateMessageTest5() throws PcepParseException { |
255 | 227 | ||
... | @@ -275,13 +247,11 @@ public class PcepInitiateMsgTest { | ... | @@ -275,13 +247,11 @@ public class PcepInitiateMsgTest { |
275 | 247 | ||
276 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 248 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
277 | PcepMessage message = null; | 249 | PcepMessage message = null; |
278 | - try { | 250 | + |
279 | message = reader.readFrom(buffer); | 251 | message = reader.readFrom(buffer); |
280 | - } catch (PcepParseException e) { | ||
281 | - e.printStackTrace(); | ||
282 | - } | ||
283 | 252 | ||
284 | - if (message instanceof PcepInitiateMsg) { | 253 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
254 | + (message instanceof PcepInitiateMsg)); | ||
285 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 255 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
286 | message.writeTo(buf); | 256 | message.writeTo(buf); |
287 | testInitiateCreationMsg = buf.array(); | 257 | testInitiateCreationMsg = buf.array(); |
... | @@ -290,19 +260,16 @@ public class PcepInitiateMsgTest { | ... | @@ -290,19 +260,16 @@ public class PcepInitiateMsgTest { |
290 | testInitiateCreationMsg = new byte[iReadLen]; | 260 | testInitiateCreationMsg = new byte[iReadLen]; |
291 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 261 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
292 | 262 | ||
293 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 263 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
294 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 264 | + initiateCreationMsg, testInitiateCreationMsg); |
295 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
296 | - } else { | ||
297 | - Assert.fail("test case failed"); | ||
298 | - log.debug("not equal"); | ||
299 | - } | ||
300 | - } else { | ||
301 | - Assert.fail("test case failed"); | ||
302 | - log.debug("not equal"); | ||
303 | - } | ||
304 | } | 265 | } |
305 | 266 | ||
267 | + /** | ||
268 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), | ||
269 | + * END-POINT, ERO objects in PcInitiate message. | ||
270 | + * | ||
271 | + * @throws PcepParseException when message paring fails | ||
272 | + */ | ||
306 | @Test | 273 | @Test |
307 | public void initiateMessageTest6() throws PcepParseException { | 274 | public void initiateMessageTest6() throws PcepParseException { |
308 | 275 | ||
... | @@ -328,13 +295,11 @@ public class PcepInitiateMsgTest { | ... | @@ -328,13 +295,11 @@ public class PcepInitiateMsgTest { |
328 | 295 | ||
329 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 296 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
330 | PcepMessage message = null; | 297 | PcepMessage message = null; |
331 | - try { | 298 | + |
332 | message = reader.readFrom(buffer); | 299 | message = reader.readFrom(buffer); |
333 | - } catch (PcepParseException e) { | ||
334 | - e.printStackTrace(); | ||
335 | - } | ||
336 | 300 | ||
337 | - if (message instanceof PcepInitiateMsg) { | 301 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
302 | + (message instanceof PcepInitiateMsg)); | ||
338 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 303 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
339 | message.writeTo(buf); | 304 | message.writeTo(buf); |
340 | testInitiateCreationMsg = buf.array(); | 305 | testInitiateCreationMsg = buf.array(); |
... | @@ -343,19 +308,16 @@ public class PcepInitiateMsgTest { | ... | @@ -343,19 +308,16 @@ public class PcepInitiateMsgTest { |
343 | testInitiateCreationMsg = new byte[iReadLen]; | 308 | testInitiateCreationMsg = new byte[iReadLen]; |
344 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 309 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
345 | 310 | ||
346 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 311 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
347 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 312 | + initiateCreationMsg, testInitiateCreationMsg); |
348 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
349 | - } else { | ||
350 | - Assert.fail("test case failed"); | ||
351 | - log.debug("not equal"); | ||
352 | - } | ||
353 | - } else { | ||
354 | - Assert.fail("test case failed"); | ||
355 | - log.debug("not equal"); | ||
356 | - } | ||
357 | } | 313 | } |
358 | 314 | ||
315 | + /** | ||
316 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), | ||
317 | + * END-POINT, ERO objects in PcInitiate message. | ||
318 | + * | ||
319 | + * @throws PcepParseException when message paring fails | ||
320 | + */ | ||
359 | @Test | 321 | @Test |
360 | public void initiateMessageTest7() throws PcepParseException { | 322 | public void initiateMessageTest7() throws PcepParseException { |
361 | 323 | ||
... | @@ -380,13 +342,11 @@ public class PcepInitiateMsgTest { | ... | @@ -380,13 +342,11 @@ public class PcepInitiateMsgTest { |
380 | 342 | ||
381 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 343 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
382 | PcepMessage message = null; | 344 | PcepMessage message = null; |
383 | - try { | 345 | + |
384 | message = reader.readFrom(buffer); | 346 | message = reader.readFrom(buffer); |
385 | - } catch (PcepParseException e) { | ||
386 | - e.printStackTrace(); | ||
387 | - } | ||
388 | 347 | ||
389 | - if (message instanceof PcepInitiateMsg) { | 348 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
349 | + (message instanceof PcepInitiateMsg)); | ||
390 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 350 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
391 | message.writeTo(buf); | 351 | message.writeTo(buf); |
392 | testInitiateCreationMsg = buf.array(); | 352 | testInitiateCreationMsg = buf.array(); |
... | @@ -395,19 +355,16 @@ public class PcepInitiateMsgTest { | ... | @@ -395,19 +355,16 @@ public class PcepInitiateMsgTest { |
395 | testInitiateCreationMsg = new byte[iReadLen]; | 355 | testInitiateCreationMsg = new byte[iReadLen]; |
396 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 356 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
397 | 357 | ||
398 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 358 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
399 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 359 | + initiateCreationMsg, testInitiateCreationMsg); |
400 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
401 | - } else { | ||
402 | - Assert.fail("test case failed"); | ||
403 | - log.debug("not equal"); | ||
404 | - } | ||
405 | - } else { | ||
406 | - Assert.fail("test case failed"); | ||
407 | - log.debug("not equal"); | ||
408 | - } | ||
409 | } | 360 | } |
410 | 361 | ||
362 | + /** | ||
363 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), | ||
364 | + * END-POINT, ERO objects in PcInitiate message. | ||
365 | + * | ||
366 | + * @throws PcepParseException when message paring fails | ||
367 | + */ | ||
411 | @Test | 368 | @Test |
412 | public void initiateMessageTest8() throws PcepParseException { | 369 | public void initiateMessageTest8() throws PcepParseException { |
413 | 370 | ||
... | @@ -431,13 +388,11 @@ public class PcepInitiateMsgTest { | ... | @@ -431,13 +388,11 @@ public class PcepInitiateMsgTest { |
431 | 388 | ||
432 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 389 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
433 | PcepMessage message = null; | 390 | PcepMessage message = null; |
434 | - try { | 391 | + |
435 | message = reader.readFrom(buffer); | 392 | message = reader.readFrom(buffer); |
436 | - } catch (PcepParseException e) { | ||
437 | - e.printStackTrace(); | ||
438 | - } | ||
439 | 393 | ||
440 | - if (message instanceof PcepInitiateMsg) { | 394 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
395 | + (message instanceof PcepInitiateMsg)); | ||
441 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 396 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
442 | message.writeTo(buf); | 397 | message.writeTo(buf); |
443 | testInitiateCreationMsg = buf.array(); | 398 | testInitiateCreationMsg = buf.array(); |
... | @@ -446,19 +401,16 @@ public class PcepInitiateMsgTest { | ... | @@ -446,19 +401,16 @@ public class PcepInitiateMsgTest { |
446 | testInitiateCreationMsg = new byte[iReadLen]; | 401 | testInitiateCreationMsg = new byte[iReadLen]; |
447 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 402 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
448 | 403 | ||
449 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 404 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
450 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 405 | + initiateCreationMsg, testInitiateCreationMsg); |
451 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
452 | - } else { | ||
453 | - Assert.fail("test case failed"); | ||
454 | - log.debug("not equal"); | ||
455 | - } | ||
456 | - } else { | ||
457 | - Assert.fail("test case failed"); | ||
458 | - log.debug("not equal"); | ||
459 | - } | ||
460 | } | 406 | } |
461 | 407 | ||
408 | + /** | ||
409 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), | ||
410 | + * END-POINT, ERO objects in PcInitiate message. | ||
411 | + * | ||
412 | + * @throws PcepParseException when message paring fails | ||
413 | + */ | ||
462 | @Test | 414 | @Test |
463 | public void initiateMessageTest9() throws PcepParseException { | 415 | public void initiateMessageTest9() throws PcepParseException { |
464 | 416 | ||
... | @@ -480,13 +432,11 @@ public class PcepInitiateMsgTest { | ... | @@ -480,13 +432,11 @@ public class PcepInitiateMsgTest { |
480 | 432 | ||
481 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 433 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
482 | PcepMessage message = null; | 434 | PcepMessage message = null; |
483 | - try { | 435 | + |
484 | message = reader.readFrom(buffer); | 436 | message = reader.readFrom(buffer); |
485 | - } catch (PcepParseException e) { | ||
486 | - e.printStackTrace(); | ||
487 | - } | ||
488 | 437 | ||
489 | - if (message instanceof PcepInitiateMsg) { | 438 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
439 | + (message instanceof PcepInitiateMsg)); | ||
490 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 440 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
491 | message.writeTo(buf); | 441 | message.writeTo(buf); |
492 | testInitiateCreationMsg = buf.array(); | 442 | testInitiateCreationMsg = buf.array(); |
... | @@ -495,19 +445,16 @@ public class PcepInitiateMsgTest { | ... | @@ -495,19 +445,16 @@ public class PcepInitiateMsgTest { |
495 | testInitiateCreationMsg = new byte[iReadLen]; | 445 | testInitiateCreationMsg = new byte[iReadLen]; |
496 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 446 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
497 | 447 | ||
498 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 448 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
499 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 449 | + initiateCreationMsg, testInitiateCreationMsg); |
500 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
501 | - } else { | ||
502 | - Assert.fail("test case failed"); | ||
503 | - log.debug("not equal"); | ||
504 | - } | ||
505 | - } else { | ||
506 | - Assert.fail("test case failed"); | ||
507 | - log.debug("not equal"); | ||
508 | - } | ||
509 | } | 450 | } |
510 | 451 | ||
452 | + /** | ||
453 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv) | ||
454 | + * objects in PcInitiate message. | ||
455 | + * | ||
456 | + * @throws PcepParseException when message paring fails | ||
457 | + */ | ||
511 | @Test | 458 | @Test |
512 | public void initiateMessageTest10() throws PcepParseException { | 459 | public void initiateMessageTest10() throws PcepParseException { |
513 | 460 | ||
... | @@ -529,13 +476,11 @@ public class PcepInitiateMsgTest { | ... | @@ -529,13 +476,11 @@ public class PcepInitiateMsgTest { |
529 | 476 | ||
530 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 477 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
531 | PcepMessage message = null; | 478 | PcepMessage message = null; |
532 | - try { | 479 | + |
533 | message = reader.readFrom(buffer); | 480 | message = reader.readFrom(buffer); |
534 | - } catch (PcepParseException e) { | ||
535 | - e.printStackTrace(); | ||
536 | - } | ||
537 | 481 | ||
538 | - if (message instanceof PcepInitiateMsg) { | 482 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
483 | + (message instanceof PcepInitiateMsg)); | ||
539 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 484 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
540 | message.writeTo(buf); | 485 | message.writeTo(buf); |
541 | testInitiateDeletionMsg = buf.array(); | 486 | testInitiateDeletionMsg = buf.array(); |
... | @@ -544,19 +489,16 @@ public class PcepInitiateMsgTest { | ... | @@ -544,19 +489,16 @@ public class PcepInitiateMsgTest { |
544 | testInitiateDeletionMsg = new byte[iReadLen]; | 489 | testInitiateDeletionMsg = new byte[iReadLen]; |
545 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 490 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
546 | 491 | ||
547 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 492 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
548 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 493 | + initiateDeletionMsg, testInitiateDeletionMsg); |
549 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
550 | - } else { | ||
551 | - Assert.fail("test case failed"); | ||
552 | - log.debug("not equal"); | ||
553 | - } | ||
554 | - } else { | ||
555 | - Assert.fail("test case failed"); | ||
556 | - log.debug("not equal"); | ||
557 | - } | ||
558 | } | 494 | } |
559 | 495 | ||
496 | + /** | ||
497 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, | ||
498 | + * StatefulLspErrorCodeTlv) objects in PcInitiate message. | ||
499 | + * | ||
500 | + * @throws PcepParseException when message paring fails | ||
501 | + */ | ||
560 | @Test | 502 | @Test |
561 | public void initiateMessageTest11() throws PcepParseException { | 503 | public void initiateMessageTest11() throws PcepParseException { |
562 | 504 | ||
... | @@ -578,13 +520,11 @@ public class PcepInitiateMsgTest { | ... | @@ -578,13 +520,11 @@ public class PcepInitiateMsgTest { |
578 | 520 | ||
579 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 521 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
580 | PcepMessage message = null; | 522 | PcepMessage message = null; |
581 | - try { | 523 | + |
582 | message = reader.readFrom(buffer); | 524 | message = reader.readFrom(buffer); |
583 | - } catch (PcepParseException e) { | ||
584 | - e.printStackTrace(); | ||
585 | - } | ||
586 | 525 | ||
587 | - if (message instanceof PcepInitiateMsg) { | 526 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
527 | + (message instanceof PcepInitiateMsg)); | ||
588 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 528 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
589 | message.writeTo(buf); | 529 | message.writeTo(buf); |
590 | testInitiateDeletionMsg = buf.array(); | 530 | testInitiateDeletionMsg = buf.array(); |
... | @@ -593,19 +533,17 @@ public class PcepInitiateMsgTest { | ... | @@ -593,19 +533,17 @@ public class PcepInitiateMsgTest { |
593 | testInitiateDeletionMsg = new byte[iReadLen]; | 533 | testInitiateDeletionMsg = new byte[iReadLen]; |
594 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 534 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
595 | 535 | ||
596 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 536 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
597 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 537 | + initiateDeletionMsg, testInitiateDeletionMsg); |
598 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | 538 | + |
599 | - } else { | ||
600 | - Assert.fail("test case failed"); | ||
601 | - log.debug("not equal"); | ||
602 | - } | ||
603 | - } else { | ||
604 | - Assert.fail("test case failed"); | ||
605 | - log.debug("not equal"); | ||
606 | - } | ||
607 | } | 539 | } |
608 | 540 | ||
541 | + /** | ||
542 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) | ||
543 | + * objects in PcInitiate message. | ||
544 | + * | ||
545 | + * @throws PcepParseException when message paring fails | ||
546 | + */ | ||
609 | @Test | 547 | @Test |
610 | public void initiateMessageTest12() throws PcepParseException { | 548 | public void initiateMessageTest12() throws PcepParseException { |
611 | 549 | ||
... | @@ -626,13 +564,11 @@ public class PcepInitiateMsgTest { | ... | @@ -626,13 +564,11 @@ public class PcepInitiateMsgTest { |
626 | 564 | ||
627 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 565 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
628 | PcepMessage message = null; | 566 | PcepMessage message = null; |
629 | - try { | 567 | + |
630 | message = reader.readFrom(buffer); | 568 | message = reader.readFrom(buffer); |
631 | - } catch (PcepParseException e) { | ||
632 | - e.printStackTrace(); | ||
633 | - } | ||
634 | 569 | ||
635 | - if (message instanceof PcepInitiateMsg) { | 570 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
571 | + (message instanceof PcepInitiateMsg)); | ||
636 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 572 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
637 | message.writeTo(buf); | 573 | message.writeTo(buf); |
638 | testInitiateDeletionMsg = buf.array(); | 574 | testInitiateDeletionMsg = buf.array(); |
... | @@ -641,19 +577,16 @@ public class PcepInitiateMsgTest { | ... | @@ -641,19 +577,16 @@ public class PcepInitiateMsgTest { |
641 | testInitiateDeletionMsg = new byte[iReadLen]; | 577 | testInitiateDeletionMsg = new byte[iReadLen]; |
642 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 578 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
643 | 579 | ||
644 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 580 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
645 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 581 | + initiateDeletionMsg, testInitiateDeletionMsg); |
646 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
647 | - } else { | ||
648 | - Assert.fail("test case failed"); | ||
649 | - log.debug("not equal"); | ||
650 | - } | ||
651 | - } else { | ||
652 | - Assert.fail("test case failed"); | ||
653 | - log.debug("not equal"); | ||
654 | - } | ||
655 | } | 582 | } |
656 | 583 | ||
584 | + /** | ||
585 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) | ||
586 | + * objects in PcInitiate message. | ||
587 | + * | ||
588 | + * @throws PcepParseException when message paring fails | ||
589 | + */ | ||
657 | @Test | 590 | @Test |
658 | public void initiateMessageTest13() throws PcepParseException { | 591 | public void initiateMessageTest13() throws PcepParseException { |
659 | 592 | ||
... | @@ -673,13 +606,11 @@ public class PcepInitiateMsgTest { | ... | @@ -673,13 +606,11 @@ public class PcepInitiateMsgTest { |
673 | 606 | ||
674 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 607 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
675 | PcepMessage message = null; | 608 | PcepMessage message = null; |
676 | - try { | 609 | + |
677 | message = reader.readFrom(buffer); | 610 | message = reader.readFrom(buffer); |
678 | - } catch (PcepParseException e) { | ||
679 | - e.printStackTrace(); | ||
680 | - } | ||
681 | 611 | ||
682 | - if (message instanceof PcepInitiateMsg) { | 612 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
613 | + (message instanceof PcepInitiateMsg)); | ||
683 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 614 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
684 | message.writeTo(buf); | 615 | message.writeTo(buf); |
685 | testInitiateDeletionMsg = buf.array(); | 616 | testInitiateDeletionMsg = buf.array(); |
... | @@ -688,19 +619,16 @@ public class PcepInitiateMsgTest { | ... | @@ -688,19 +619,16 @@ public class PcepInitiateMsgTest { |
688 | testInitiateDeletionMsg = new byte[iReadLen]; | 619 | testInitiateDeletionMsg = new byte[iReadLen]; |
689 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 620 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
690 | 621 | ||
691 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 622 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
692 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 623 | + initiateDeletionMsg, testInitiateDeletionMsg); |
693 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
694 | - } else { | ||
695 | - Assert.fail("test case failed"); | ||
696 | - log.debug("not equal"); | ||
697 | - } | ||
698 | - } else { | ||
699 | - Assert.fail("test case failed"); | ||
700 | - log.debug("not equal"); | ||
701 | - } | ||
702 | } | 624 | } |
703 | 625 | ||
626 | + /** | ||
627 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) | ||
628 | + * objects in PcInitiate message. | ||
629 | + * | ||
630 | + * @throws PcepParseException when message paring fails | ||
631 | + */ | ||
704 | @Test | 632 | @Test |
705 | public void initiateMessageTest14() throws PcepParseException { | 633 | public void initiateMessageTest14() throws PcepParseException { |
706 | 634 | ||
... | @@ -720,13 +648,11 @@ public class PcepInitiateMsgTest { | ... | @@ -720,13 +648,11 @@ public class PcepInitiateMsgTest { |
720 | 648 | ||
721 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 649 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
722 | PcepMessage message = null; | 650 | PcepMessage message = null; |
723 | - try { | 651 | + |
724 | message = reader.readFrom(buffer); | 652 | message = reader.readFrom(buffer); |
725 | - } catch (PcepParseException e) { | ||
726 | - e.printStackTrace(); | ||
727 | - } | ||
728 | 653 | ||
729 | - if (message instanceof PcepInitiateMsg) { | 654 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
655 | + (message instanceof PcepInitiateMsg)); | ||
730 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 656 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
731 | message.writeTo(buf); | 657 | message.writeTo(buf); |
732 | testInitiateDeletionMsg = buf.array(); | 658 | testInitiateDeletionMsg = buf.array(); |
... | @@ -735,19 +661,17 @@ public class PcepInitiateMsgTest { | ... | @@ -735,19 +661,17 @@ public class PcepInitiateMsgTest { |
735 | testInitiateDeletionMsg = new byte[iReadLen]; | 661 | testInitiateDeletionMsg = new byte[iReadLen]; |
736 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 662 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
737 | 663 | ||
738 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 664 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
739 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 665 | + initiateDeletionMsg, testInitiateDeletionMsg); |
740 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | 666 | + |
741 | - } else { | ||
742 | - Assert.fail("test case failed"); | ||
743 | - log.debug("not equal"); | ||
744 | - } | ||
745 | - } else { | ||
746 | - Assert.fail("test case failed"); | ||
747 | - log.debug("not equal"); | ||
748 | - } | ||
749 | } | 667 | } |
750 | 668 | ||
669 | + /** | ||
670 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv) | ||
671 | + * objects in PcInitiate message. | ||
672 | + * | ||
673 | + * @throws PcepParseException when message paring fails | ||
674 | + */ | ||
751 | @Test | 675 | @Test |
752 | public void initiateMessageTest15() throws PcepParseException { | 676 | public void initiateMessageTest15() throws PcepParseException { |
753 | 677 | ||
... | @@ -766,13 +690,11 @@ public class PcepInitiateMsgTest { | ... | @@ -766,13 +690,11 @@ public class PcepInitiateMsgTest { |
766 | 690 | ||
767 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 691 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
768 | PcepMessage message = null; | 692 | PcepMessage message = null; |
769 | - try { | 693 | + |
770 | message = reader.readFrom(buffer); | 694 | message = reader.readFrom(buffer); |
771 | - } catch (PcepParseException e) { | ||
772 | - e.printStackTrace(); | ||
773 | - } | ||
774 | 695 | ||
775 | - if (message instanceof PcepInitiateMsg) { | 696 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
697 | + (message instanceof PcepInitiateMsg)); | ||
776 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 698 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
777 | message.writeTo(buf); | 699 | message.writeTo(buf); |
778 | testInitiateDeletionMsg = buf.array(); | 700 | testInitiateDeletionMsg = buf.array(); |
... | @@ -781,19 +703,16 @@ public class PcepInitiateMsgTest { | ... | @@ -781,19 +703,16 @@ public class PcepInitiateMsgTest { |
781 | testInitiateDeletionMsg = new byte[iReadLen]; | 703 | testInitiateDeletionMsg = new byte[iReadLen]; |
782 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 704 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
783 | 705 | ||
784 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 706 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateDeletionMsg, testInitiateDeletionMsg); |
785 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 707 | + |
786 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
787 | - } else { | ||
788 | - Assert.fail("test case failed"); | ||
789 | - log.debug("not equal"); | ||
790 | - } | ||
791 | - } else { | ||
792 | - Assert.fail("test case failed"); | ||
793 | - log.debug("not equal"); | ||
794 | - } | ||
795 | } | 708 | } |
796 | 709 | ||
710 | + /** | ||
711 | + * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa | ||
712 | + * objects in PcInitiate message. | ||
713 | + * | ||
714 | + * @throws PcepParseException when message paring fails | ||
715 | + */ | ||
797 | @Test | 716 | @Test |
798 | public void initiateMessageTest16() throws PcepParseException { | 717 | public void initiateMessageTest16() throws PcepParseException { |
799 | 718 | ||
... | @@ -815,13 +734,11 @@ public class PcepInitiateMsgTest { | ... | @@ -815,13 +734,11 @@ public class PcepInitiateMsgTest { |
815 | 734 | ||
816 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 735 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
817 | PcepMessage message = null; | 736 | PcepMessage message = null; |
818 | - try { | 737 | + |
819 | message = reader.readFrom(buffer); | 738 | message = reader.readFrom(buffer); |
820 | - } catch (PcepParseException e) { | ||
821 | - e.printStackTrace(); | ||
822 | - } | ||
823 | 739 | ||
824 | - if (message instanceof PcepInitiateMsg) { | 740 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
741 | + (message instanceof PcepInitiateMsg)); | ||
825 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 742 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
826 | message.writeTo(buf); | 743 | message.writeTo(buf); |
827 | testInitiateCreationMsg = buf.array(); | 744 | testInitiateCreationMsg = buf.array(); |
... | @@ -830,19 +747,16 @@ public class PcepInitiateMsgTest { | ... | @@ -830,19 +747,16 @@ public class PcepInitiateMsgTest { |
830 | testInitiateCreationMsg = new byte[iReadLen]; | 747 | testInitiateCreationMsg = new byte[iReadLen]; |
831 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 748 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
832 | 749 | ||
833 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 750 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
834 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 751 | + initiateCreationMsg, testInitiateCreationMsg); |
835 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
836 | - } else { | ||
837 | - Assert.fail("test case failed"); | ||
838 | - log.debug("not equal"); | ||
839 | - } | ||
840 | - } else { | ||
841 | - Assert.fail("test case failed"); | ||
842 | - log.debug("not equal"); | ||
843 | - } | ||
844 | } | 752 | } |
845 | 753 | ||
754 | + /** | ||
755 | + * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth | ||
756 | + * objects in PcInitiate message. | ||
757 | + * | ||
758 | + * @throws PcepParseException when message paring fails | ||
759 | + */ | ||
846 | @Test | 760 | @Test |
847 | public void initiateMessageTest17() throws PcepParseException { | 761 | public void initiateMessageTest17() throws PcepParseException { |
848 | 762 | ||
... | @@ -865,13 +779,11 @@ public class PcepInitiateMsgTest { | ... | @@ -865,13 +779,11 @@ public class PcepInitiateMsgTest { |
865 | 779 | ||
866 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 780 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
867 | PcepMessage message = null; | 781 | PcepMessage message = null; |
868 | - try { | 782 | + |
869 | message = reader.readFrom(buffer); | 783 | message = reader.readFrom(buffer); |
870 | - } catch (PcepParseException e) { | ||
871 | - e.printStackTrace(); | ||
872 | - } | ||
873 | 784 | ||
874 | - if (message instanceof PcepInitiateMsg) { | 785 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
786 | + (message instanceof PcepInitiateMsg)); | ||
875 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 787 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
876 | message.writeTo(buf); | 788 | message.writeTo(buf); |
877 | testInitiateCreationMsg = buf.array(); | 789 | testInitiateCreationMsg = buf.array(); |
... | @@ -880,19 +792,16 @@ public class PcepInitiateMsgTest { | ... | @@ -880,19 +792,16 @@ public class PcepInitiateMsgTest { |
880 | testInitiateCreationMsg = new byte[iReadLen]; | 792 | testInitiateCreationMsg = new byte[iReadLen]; |
881 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 793 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
882 | 794 | ||
883 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 795 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
884 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 796 | + |
885 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
886 | - } else { | ||
887 | - Assert.fail("test case failed"); | ||
888 | - log.debug("not equal"); | ||
889 | - } | ||
890 | - } else { | ||
891 | - Assert.fail("test case failed"); | ||
892 | - log.debug("not equal"); | ||
893 | - } | ||
894 | } | 797 | } |
895 | 798 | ||
799 | + /** | ||
800 | + * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list | ||
801 | + * objects in PcInitiate message. | ||
802 | + * | ||
803 | + * @throws PcepParseException when message paring fails | ||
804 | + */ | ||
896 | @Test | 805 | @Test |
897 | public void initiateMessageTest18() throws PcepParseException { | 806 | public void initiateMessageTest18() throws PcepParseException { |
898 | //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list | 807 | //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list |
... | @@ -915,13 +824,11 @@ public class PcepInitiateMsgTest { | ... | @@ -915,13 +824,11 @@ public class PcepInitiateMsgTest { |
915 | 824 | ||
916 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 825 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
917 | PcepMessage message = null; | 826 | PcepMessage message = null; |
918 | - try { | 827 | + |
919 | message = reader.readFrom(buffer); | 828 | message = reader.readFrom(buffer); |
920 | - } catch (PcepParseException e) { | ||
921 | - e.printStackTrace(); | ||
922 | - } | ||
923 | 829 | ||
924 | - if (message instanceof PcepInitiateMsg) { | 830 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
831 | + (message instanceof PcepInitiateMsg)); | ||
925 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 832 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
926 | message.writeTo(buf); | 833 | message.writeTo(buf); |
927 | testInitiateCreationMsg = buf.array(); | 834 | testInitiateCreationMsg = buf.array(); |
... | @@ -930,19 +837,17 @@ public class PcepInitiateMsgTest { | ... | @@ -930,19 +837,17 @@ public class PcepInitiateMsgTest { |
930 | testInitiateCreationMsg = new byte[iReadLen]; | 837 | testInitiateCreationMsg = new byte[iReadLen]; |
931 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 838 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
932 | 839 | ||
933 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 840 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
934 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 841 | + initiateCreationMsg, testInitiateCreationMsg); |
935 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 842 | + |
936 | - } else { | ||
937 | - Assert.fail("test case failed"); | ||
938 | - log.debug("not equal"); | ||
939 | - } | ||
940 | - } else { | ||
941 | - Assert.fail("test case failed"); | ||
942 | - log.debug("not equal"); | ||
943 | - } | ||
944 | } | 843 | } |
945 | 844 | ||
845 | + /** | ||
846 | + * This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list | ||
847 | + * objects in PcInitiate message. | ||
848 | + * | ||
849 | + * @throws PcepParseException when message paring fails | ||
850 | + */ | ||
946 | @Test | 851 | @Test |
947 | public void initiateMessageTest19() throws PcepParseException { | 852 | public void initiateMessageTest19() throws PcepParseException { |
948 | //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list | 853 | //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list |
... | @@ -967,13 +872,11 @@ public class PcepInitiateMsgTest { | ... | @@ -967,13 +872,11 @@ public class PcepInitiateMsgTest { |
967 | 872 | ||
968 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 873 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
969 | PcepMessage message = null; | 874 | PcepMessage message = null; |
970 | - try { | 875 | + |
971 | message = reader.readFrom(buffer); | 876 | message = reader.readFrom(buffer); |
972 | - } catch (PcepParseException e) { | ||
973 | - e.printStackTrace(); | ||
974 | - } | ||
975 | 877 | ||
976 | - if (message instanceof PcepInitiateMsg) { | 878 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
879 | + (message instanceof PcepInitiateMsg)); | ||
977 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 880 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
978 | message.writeTo(buf); | 881 | message.writeTo(buf); |
979 | testInitiateCreationMsg = buf.array(); | 882 | testInitiateCreationMsg = buf.array(); |
... | @@ -982,19 +885,16 @@ public class PcepInitiateMsgTest { | ... | @@ -982,19 +885,16 @@ public class PcepInitiateMsgTest { |
982 | testInitiateCreationMsg = new byte[iReadLen]; | 885 | testInitiateCreationMsg = new byte[iReadLen]; |
983 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 886 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
984 | 887 | ||
985 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 888 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
986 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 889 | + initiateCreationMsg, testInitiateCreationMsg); |
987 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
988 | - } else { | ||
989 | - Assert.fail("test case failed"); | ||
990 | - log.debug("not equal"); | ||
991 | - } | ||
992 | - } else { | ||
993 | - Assert.fail("test case failed"); | ||
994 | - log.debug("not equal"); | ||
995 | - } | ||
996 | } | 890 | } |
997 | 891 | ||
892 | + /** | ||
893 | + * This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, | ||
894 | + * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message. | ||
895 | + * | ||
896 | + * @throws PcepParseException when message paring fails | ||
897 | + */ | ||
998 | @Test | 898 | @Test |
999 | public void initiateMessageTest20() throws PcepParseException { | 899 | public void initiateMessageTest20() throws PcepParseException { |
1000 | /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, | 900 | /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, |
... | @@ -1020,13 +920,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1020,13 +920,11 @@ public class PcepInitiateMsgTest { |
1020 | 920 | ||
1021 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 921 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1022 | PcepMessage message = null; | 922 | PcepMessage message = null; |
1023 | - try { | 923 | + |
1024 | message = reader.readFrom(buffer); | 924 | message = reader.readFrom(buffer); |
1025 | - } catch (PcepParseException e) { | ||
1026 | - e.printStackTrace(); | ||
1027 | - } | ||
1028 | 925 | ||
1029 | - if (message instanceof PcepInitiateMsg) { | 926 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
927 | + (message instanceof PcepInitiateMsg)); | ||
1030 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 928 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1031 | message.writeTo(buf); | 929 | message.writeTo(buf); |
1032 | testInitiateDeletionMsg = buf.array(); | 930 | testInitiateDeletionMsg = buf.array(); |
... | @@ -1035,19 +933,17 @@ public class PcepInitiateMsgTest { | ... | @@ -1035,19 +933,17 @@ public class PcepInitiateMsgTest { |
1035 | testInitiateDeletionMsg = new byte[iReadLen]; | 933 | testInitiateDeletionMsg = new byte[iReadLen]; |
1036 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 934 | buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
1037 | 935 | ||
1038 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 936 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1039 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | 937 | + initiateDeletionMsg, testInitiateDeletionMsg); |
1040 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | 938 | + |
1041 | - } else { | ||
1042 | - Assert.fail("test case failed"); | ||
1043 | - log.debug("not equal"); | ||
1044 | - } | ||
1045 | - } else { | ||
1046 | - Assert.fail("test case failed"); | ||
1047 | - log.debug("not equal"); | ||
1048 | - } | ||
1049 | } | 939 | } |
1050 | 940 | ||
941 | + /** | ||
942 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero | ||
943 | + * objects in PcInitiate message. | ||
944 | + * | ||
945 | + * @throws PcepParseException when message paring fails | ||
946 | + */ | ||
1051 | @Test | 947 | @Test |
1052 | public void initiateMessageTest21() throws PcepParseException { | 948 | public void initiateMessageTest21() throws PcepParseException { |
1053 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, | 949 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, |
... | @@ -1079,13 +975,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1079,13 +975,11 @@ public class PcepInitiateMsgTest { |
1079 | 975 | ||
1080 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 976 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1081 | PcepMessage message = null; | 977 | PcepMessage message = null; |
1082 | - try { | 978 | + |
1083 | message = reader.readFrom(buffer); | 979 | message = reader.readFrom(buffer); |
1084 | - } catch (PcepParseException e) { | ||
1085 | - e.printStackTrace(); | ||
1086 | - } | ||
1087 | 980 | ||
1088 | - if (message instanceof PcepInitiateMsg) { | 981 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
982 | + (message instanceof PcepInitiateMsg)); | ||
1089 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 983 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1090 | message.writeTo(buf); | 984 | message.writeTo(buf); |
1091 | testInitiateCreationMsg = buf.array(); | 985 | testInitiateCreationMsg = buf.array(); |
... | @@ -1094,19 +988,17 @@ public class PcepInitiateMsgTest { | ... | @@ -1094,19 +988,17 @@ public class PcepInitiateMsgTest { |
1094 | testInitiateCreationMsg = new byte[iReadLen]; | 988 | testInitiateCreationMsg = new byte[iReadLen]; |
1095 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 989 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1096 | 990 | ||
1097 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 991 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1098 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 992 | + initiateCreationMsg, testInitiateCreationMsg); |
1099 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 993 | + |
1100 | - } else { | ||
1101 | - Assert.fail("test case failed"); | ||
1102 | - log.debug("not equal"); | ||
1103 | - } | ||
1104 | - } else { | ||
1105 | - Assert.fail("test case failed"); | ||
1106 | - log.debug("not equal"); | ||
1107 | - } | ||
1108 | } | 994 | } |
1109 | 995 | ||
996 | + /** | ||
997 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa | ||
998 | + * objects in PcInitiate message. | ||
999 | + * | ||
1000 | + * @throws PcepParseException when message paring fails | ||
1001 | + */ | ||
1110 | @Test | 1002 | @Test |
1111 | public void initiateMessageTest22() throws PcepParseException { | 1003 | public void initiateMessageTest22() throws PcepParseException { |
1112 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, | 1004 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, |
... | @@ -1140,13 +1032,10 @@ public class PcepInitiateMsgTest { | ... | @@ -1140,13 +1032,10 @@ public class PcepInitiateMsgTest { |
1140 | 1032 | ||
1141 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1033 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1142 | PcepMessage message = null; | 1034 | PcepMessage message = null; |
1143 | - try { | ||
1144 | message = reader.readFrom(buffer); | 1035 | message = reader.readFrom(buffer); |
1145 | - } catch (PcepParseException e) { | ||
1146 | - e.printStackTrace(); | ||
1147 | - } | ||
1148 | 1036 | ||
1149 | - if (message instanceof PcepInitiateMsg) { | 1037 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1038 | + (message instanceof PcepInitiateMsg)); | ||
1150 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1039 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1151 | message.writeTo(buf); | 1040 | message.writeTo(buf); |
1152 | testInitiateCreationMsg = buf.array(); | 1041 | testInitiateCreationMsg = buf.array(); |
... | @@ -1155,19 +1044,16 @@ public class PcepInitiateMsgTest { | ... | @@ -1155,19 +1044,16 @@ public class PcepInitiateMsgTest { |
1155 | testInitiateCreationMsg = new byte[iReadLen]; | 1044 | testInitiateCreationMsg = new byte[iReadLen]; |
1156 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1045 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1157 | 1046 | ||
1158 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1047 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1159 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1048 | + |
1160 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1161 | - } else { | ||
1162 | - Assert.fail("test case failed"); | ||
1163 | - log.debug("not equal"); | ||
1164 | - } | ||
1165 | - } else { | ||
1166 | - Assert.fail("test case failed"); | ||
1167 | - log.debug("not equal"); | ||
1168 | - } | ||
1169 | } | 1049 | } |
1170 | 1050 | ||
1051 | + /** | ||
1052 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth | ||
1053 | + * objects in PcInitiate message. | ||
1054 | + * | ||
1055 | + * @throws PcepParseException when message paring fails | ||
1056 | + */ | ||
1171 | @Test | 1057 | @Test |
1172 | public void initiateMessageTest23() throws PcepParseException { | 1058 | public void initiateMessageTest23() throws PcepParseException { |
1173 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, | 1059 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, |
... | @@ -1202,13 +1088,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1202,13 +1088,11 @@ public class PcepInitiateMsgTest { |
1202 | 1088 | ||
1203 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1089 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1204 | PcepMessage message = null; | 1090 | PcepMessage message = null; |
1205 | - try { | 1091 | + |
1206 | message = reader.readFrom(buffer); | 1092 | message = reader.readFrom(buffer); |
1207 | - } catch (PcepParseException e) { | ||
1208 | - e.printStackTrace(); | ||
1209 | - } | ||
1210 | 1093 | ||
1211 | - if (message instanceof PcepInitiateMsg) { | 1094 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1095 | + (message instanceof PcepInitiateMsg)); | ||
1212 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1096 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1213 | message.writeTo(buf); | 1097 | message.writeTo(buf); |
1214 | testInitiateCreationMsg = buf.array(); | 1098 | testInitiateCreationMsg = buf.array(); |
... | @@ -1217,19 +1101,16 @@ public class PcepInitiateMsgTest { | ... | @@ -1217,19 +1101,16 @@ public class PcepInitiateMsgTest { |
1217 | testInitiateCreationMsg = new byte[iReadLen]; | 1101 | testInitiateCreationMsg = new byte[iReadLen]; |
1218 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1102 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1219 | 1103 | ||
1220 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1104 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1221 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1105 | + initiateCreationMsg, testInitiateCreationMsg); |
1222 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1223 | - } else { | ||
1224 | - Assert.fail("test case failed"); | ||
1225 | - log.debug("not equal"); | ||
1226 | - } | ||
1227 | - } else { | ||
1228 | - Assert.fail("test case failed"); | ||
1229 | - log.debug("not equal"); | ||
1230 | - } | ||
1231 | } | 1106 | } |
1232 | 1107 | ||
1108 | + /** | ||
1109 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth | ||
1110 | + * objects in PcInitiate message. | ||
1111 | + * | ||
1112 | + * @throws PcepParseException when message paring fails | ||
1113 | + */ | ||
1233 | @Test | 1114 | @Test |
1234 | public void initiateMessageTest24() throws PcepParseException { | 1115 | public void initiateMessageTest24() throws PcepParseException { |
1235 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, | 1116 | /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, |
... | @@ -1264,13 +1145,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1264,13 +1145,11 @@ public class PcepInitiateMsgTest { |
1264 | 1145 | ||
1265 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1146 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1266 | PcepMessage message = null; | 1147 | PcepMessage message = null; |
1267 | - try { | 1148 | + |
1268 | message = reader.readFrom(buffer); | 1149 | message = reader.readFrom(buffer); |
1269 | - } catch (PcepParseException e) { | ||
1270 | - e.printStackTrace(); | ||
1271 | - } | ||
1272 | 1150 | ||
1273 | - if (message instanceof PcepInitiateMsg) { | 1151 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1152 | + (message instanceof PcepInitiateMsg)); | ||
1274 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1153 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1275 | message.writeTo(buf); | 1154 | message.writeTo(buf); |
1276 | testInitiateCreationMsg = buf.array(); | 1155 | testInitiateCreationMsg = buf.array(); |
... | @@ -1279,19 +1158,16 @@ public class PcepInitiateMsgTest { | ... | @@ -1279,19 +1158,16 @@ public class PcepInitiateMsgTest { |
1279 | testInitiateCreationMsg = new byte[iReadLen]; | 1158 | testInitiateCreationMsg = new byte[iReadLen]; |
1280 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1159 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1281 | 1160 | ||
1282 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1161 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1283 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1284 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1285 | - } else { | ||
1286 | - Assert.fail("test case failed"); | ||
1287 | - log.debug("not equal"); | ||
1288 | - } | ||
1289 | - } else { | ||
1290 | - Assert.fail("test case failed"); | ||
1291 | - log.debug("not equal"); | ||
1292 | - } | ||
1293 | } | 1162 | } |
1294 | 1163 | ||
1164 | + /** | ||
1165 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth, | ||
1166 | + * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list | ||
1167 | + * objects in PcInitiate message. | ||
1168 | + * | ||
1169 | + * @throws PcepParseException when message paring fails | ||
1170 | + */ | ||
1295 | @Test | 1171 | @Test |
1296 | public void initiateMessageTest25() throws PcepParseException { | 1172 | public void initiateMessageTest25() throws PcepParseException { |
1297 | 1173 | ||
... | @@ -1329,13 +1205,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1329,13 +1205,11 @@ public class PcepInitiateMsgTest { |
1329 | 1205 | ||
1330 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1206 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1331 | PcepMessage message = null; | 1207 | PcepMessage message = null; |
1332 | - try { | 1208 | + |
1333 | message = reader.readFrom(buffer); | 1209 | message = reader.readFrom(buffer); |
1334 | - } catch (PcepParseException e) { | ||
1335 | - e.printStackTrace(); | ||
1336 | - } | ||
1337 | 1210 | ||
1338 | - if (message instanceof PcepInitiateMsg) { | 1211 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1212 | + (message instanceof PcepInitiateMsg)); | ||
1339 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1213 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1340 | message.writeTo(buf); | 1214 | message.writeTo(buf); |
1341 | testInitiateCreationMsg = buf.array(); | 1215 | testInitiateCreationMsg = buf.array(); |
... | @@ -1344,19 +1218,18 @@ public class PcepInitiateMsgTest { | ... | @@ -1344,19 +1218,18 @@ public class PcepInitiateMsgTest { |
1344 | testInitiateCreationMsg = new byte[iReadLen]; | 1218 | testInitiateCreationMsg = new byte[iReadLen]; |
1345 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1219 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1346 | 1220 | ||
1347 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1221 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1348 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1222 | + initiateCreationMsg, testInitiateCreationMsg); |
1349 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 1223 | + |
1350 | - } else { | ||
1351 | - Assert.fail("test case failed"); | ||
1352 | - log.debug("not equal"); | ||
1353 | - } | ||
1354 | - } else { | ||
1355 | - Assert.fail("test case failed"); | ||
1356 | - log.debug("not equal"); | ||
1357 | - } | ||
1358 | } | 1224 | } |
1359 | 1225 | ||
1226 | + /** | ||
1227 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list, | ||
1228 | + * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list | ||
1229 | + * objects in PcInitiate message. | ||
1230 | + * | ||
1231 | + * @throws PcepParseException when message paring fails | ||
1232 | + */ | ||
1360 | @Test | 1233 | @Test |
1361 | public void initiateMessageTest26() throws PcepParseException { | 1234 | public void initiateMessageTest26() throws PcepParseException { |
1362 | 1235 | ||
... | @@ -1395,13 +1268,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1395,13 +1268,11 @@ public class PcepInitiateMsgTest { |
1395 | 1268 | ||
1396 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1269 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1397 | PcepMessage message = null; | 1270 | PcepMessage message = null; |
1398 | - try { | 1271 | + |
1399 | message = reader.readFrom(buffer); | 1272 | message = reader.readFrom(buffer); |
1400 | - } catch (PcepParseException e) { | ||
1401 | - e.printStackTrace(); | ||
1402 | - } | ||
1403 | 1273 | ||
1404 | - if (message instanceof PcepInitiateMsg) { | 1274 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1275 | + (message instanceof PcepInitiateMsg)); | ||
1405 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1276 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1406 | message.writeTo(buf); | 1277 | message.writeTo(buf); |
1407 | testInitiateCreationMsg = buf.array(); | 1278 | testInitiateCreationMsg = buf.array(); |
... | @@ -1410,19 +1281,18 @@ public class PcepInitiateMsgTest { | ... | @@ -1410,19 +1281,18 @@ public class PcepInitiateMsgTest { |
1410 | testInitiateCreationMsg = new byte[iReadLen]; | 1281 | testInitiateCreationMsg = new byte[iReadLen]; |
1411 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1282 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1412 | 1283 | ||
1413 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1284 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1414 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1285 | + initiateCreationMsg, testInitiateCreationMsg); |
1415 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 1286 | + |
1416 | - } else { | ||
1417 | - Assert.fail("test case failed"); | ||
1418 | - log.debug("not equal"); | ||
1419 | - } | ||
1420 | - } else { | ||
1421 | - Assert.fail("test case failed"); | ||
1422 | - log.debug("not equal"); | ||
1423 | - } | ||
1424 | } | 1287 | } |
1425 | 1288 | ||
1289 | + /** | ||
1290 | + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list, | ||
1291 | + * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list | ||
1292 | + * objects in PcInitiate message. | ||
1293 | + * | ||
1294 | + * @throws PcepParseException when message paring fails | ||
1295 | + */ | ||
1426 | @Test | 1296 | @Test |
1427 | public void initiateMessageTest27() throws PcepParseException { | 1297 | public void initiateMessageTest27() throws PcepParseException { |
1428 | 1298 | ||
... | @@ -1463,13 +1333,11 @@ public class PcepInitiateMsgTest { | ... | @@ -1463,13 +1333,11 @@ public class PcepInitiateMsgTest { |
1463 | 1333 | ||
1464 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1334 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1465 | PcepMessage message = null; | 1335 | PcepMessage message = null; |
1466 | - try { | 1336 | + |
1467 | message = reader.readFrom(buffer); | 1337 | message = reader.readFrom(buffer); |
1468 | - } catch (PcepParseException e) { | ||
1469 | - e.printStackTrace(); | ||
1470 | - } | ||
1471 | 1338 | ||
1472 | - if (message instanceof PcepInitiateMsg) { | 1339 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1340 | + (message instanceof PcepInitiateMsg)); | ||
1473 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1341 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1474 | message.writeTo(buf); | 1342 | message.writeTo(buf); |
1475 | testInitiateCreationMsg = buf.array(); | 1343 | testInitiateCreationMsg = buf.array(); |
... | @@ -1478,16 +1346,7 @@ public class PcepInitiateMsgTest { | ... | @@ -1478,16 +1346,7 @@ public class PcepInitiateMsgTest { |
1478 | testInitiateCreationMsg = new byte[iReadLen]; | 1346 | testInitiateCreationMsg = new byte[iReadLen]; |
1479 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1347 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1480 | 1348 | ||
1481 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1349 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1482 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1350 | + initiateCreationMsg, testInitiateCreationMsg); |
1483 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1484 | - } else { | ||
1485 | - Assert.fail("test case failed"); | ||
1486 | - log.debug("not equal"); | ||
1487 | - } | ||
1488 | - } else { | ||
1489 | - Assert.fail("test case failed"); | ||
1490 | - log.debug("not equal"); | ||
1491 | - } | ||
1492 | } | 1351 | } |
1493 | } | 1352 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,12 +15,9 @@ | ... | @@ -15,12 +15,9 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.pcepio; | 16 | package org.onosproject.pcepio; |
17 | 17 | ||
18 | -import java.util.Arrays; | ||
19 | import org.jboss.netty.buffer.ChannelBuffer; | 18 | import org.jboss.netty.buffer.ChannelBuffer; |
20 | import org.jboss.netty.buffer.ChannelBuffers; | 19 | import org.jboss.netty.buffer.ChannelBuffers; |
21 | -import org.junit.After; | ||
22 | import org.junit.Assert; | 20 | import org.junit.Assert; |
23 | -import org.junit.Before; | ||
24 | import org.junit.Test; | 21 | import org.junit.Test; |
25 | import org.onosproject.pcepio.exceptions.PcepParseException; | 22 | import org.onosproject.pcepio.exceptions.PcepParseException; |
26 | import org.onosproject.pcepio.protocol.PcepFactories; | 23 | import org.onosproject.pcepio.protocol.PcepFactories; |
... | @@ -34,16 +31,13 @@ public class PcepInitiateMsgTest2 { | ... | @@ -34,16 +31,13 @@ public class PcepInitiateMsgTest2 { |
34 | 31 | ||
35 | protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class); | 32 | protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class); |
36 | 33 | ||
37 | - @Before | 34 | + /** |
38 | - public void startUp() { | 35 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, |
39 | - | 36 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), |
40 | - } | 37 | + * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST objects in PcInitiate message. |
41 | - | 38 | + * |
42 | - @After | 39 | + * @throws PcepParseException when message paring fails |
43 | - public void tearDown() { | 40 | + */ |
44 | - | ||
45 | - } | ||
46 | - | ||
47 | @Test | 41 | @Test |
48 | public void initiateMessageTest1() throws PcepParseException { | 42 | public void initiateMessageTest1() throws PcepParseException { |
49 | 43 | ||
... | @@ -76,13 +70,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -76,13 +70,10 @@ public class PcepInitiateMsgTest2 { |
76 | 70 | ||
77 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 71 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
78 | PcepMessage message = null; | 72 | PcepMessage message = null; |
79 | - try { | 73 | + |
80 | message = reader.readFrom(buffer); | 74 | message = reader.readFrom(buffer); |
81 | - } catch (PcepParseException e) { | ||
82 | - e.printStackTrace(); | ||
83 | - } | ||
84 | 75 | ||
85 | - if (message instanceof PcepInitiateMsg) { | 76 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
86 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 77 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
87 | message.writeTo(buf); | 78 | message.writeTo(buf); |
88 | testInitiateCreationMsg = buf.array(); | 79 | testInitiateCreationMsg = buf.array(); |
... | @@ -91,19 +82,18 @@ public class PcepInitiateMsgTest2 { | ... | @@ -91,19 +82,18 @@ public class PcepInitiateMsgTest2 { |
91 | testInitiateCreationMsg = new byte[iReadLen]; | 82 | testInitiateCreationMsg = new byte[iReadLen]; |
92 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 83 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
93 | 84 | ||
94 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 85 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
95 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 86 | + |
96 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
97 | - } else { | ||
98 | - Assert.fail("test case failed"); | ||
99 | - log.debug("not equal"); | ||
100 | - } | ||
101 | - } else { | ||
102 | - Assert.fail("test case failed"); | ||
103 | - log.debug("not equal"); | ||
104 | - } | ||
105 | } | 87 | } |
106 | 88 | ||
89 | + /** | ||
90 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
91 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, | ||
92 | + * StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT | ||
93 | + * objects in PcInitiate message. | ||
94 | + * | ||
95 | + * @throws PcepParseException when message paring fails | ||
96 | + */ | ||
107 | @Test | 97 | @Test |
108 | public void initiateMessageTest2() throws PcepParseException { | 98 | public void initiateMessageTest2() throws PcepParseException { |
109 | 99 | ||
... | @@ -137,13 +127,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -137,13 +127,10 @@ public class PcepInitiateMsgTest2 { |
137 | 127 | ||
138 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 128 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
139 | PcepMessage message = null; | 129 | PcepMessage message = null; |
140 | - try { | 130 | + |
141 | message = reader.readFrom(buffer); | 131 | message = reader.readFrom(buffer); |
142 | - } catch (PcepParseException e) { | ||
143 | - e.printStackTrace(); | ||
144 | - } | ||
145 | 132 | ||
146 | - if (message instanceof PcepInitiateMsg) { | 133 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
147 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 134 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
148 | message.writeTo(buf); | 135 | message.writeTo(buf); |
149 | testInitiateCreationMsg = buf.array(); | 136 | testInitiateCreationMsg = buf.array(); |
... | @@ -152,19 +139,17 @@ public class PcepInitiateMsgTest2 { | ... | @@ -152,19 +139,17 @@ public class PcepInitiateMsgTest2 { |
152 | testInitiateCreationMsg = new byte[iReadLen]; | 139 | testInitiateCreationMsg = new byte[iReadLen]; |
153 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 140 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
154 | 141 | ||
155 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 142 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
156 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 143 | + initiateCreationMsg, testInitiateCreationMsg); |
157 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
158 | - } else { | ||
159 | - Assert.fail("test case failed"); | ||
160 | - log.debug("not equal"); | ||
161 | - } | ||
162 | - } else { | ||
163 | - Assert.fail("test case failed"); | ||
164 | - log.debug("not equal"); | ||
165 | - } | ||
166 | } | 144 | } |
167 | 145 | ||
146 | + /** | ||
147 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, | ||
148 | + * StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, | ||
149 | + * ERO, LSPA, BANDWIDTH objects in PcInitiate message. | ||
150 | + * | ||
151 | + * @throws PcepParseException when message paring fails | ||
152 | + */ | ||
168 | @Test | 153 | @Test |
169 | public void initiateMessageTest3() throws PcepParseException { | 154 | public void initiateMessageTest3() throws PcepParseException { |
170 | 155 | ||
... | @@ -197,13 +182,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -197,13 +182,10 @@ public class PcepInitiateMsgTest2 { |
197 | 182 | ||
198 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 183 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
199 | PcepMessage message = null; | 184 | PcepMessage message = null; |
200 | - try { | 185 | + |
201 | message = reader.readFrom(buffer); | 186 | message = reader.readFrom(buffer); |
202 | - } catch (PcepParseException e) { | ||
203 | - e.printStackTrace(); | ||
204 | - } | ||
205 | 187 | ||
206 | - if (message instanceof PcepInitiateMsg) { | 188 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
207 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 189 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
208 | message.writeTo(buf); | 190 | message.writeTo(buf); |
209 | testInitiateCreationMsg = buf.array(); | 191 | testInitiateCreationMsg = buf.array(); |
... | @@ -212,19 +194,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -212,19 +194,16 @@ public class PcepInitiateMsgTest2 { |
212 | testInitiateCreationMsg = new byte[iReadLen]; | 194 | testInitiateCreationMsg = new byte[iReadLen]; |
213 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 195 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
214 | 196 | ||
215 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 197 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
216 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
217 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
218 | - } else { | ||
219 | - Assert.fail("test case failed"); | ||
220 | - log.debug("not equal"); | ||
221 | - } | ||
222 | - } else { | ||
223 | - Assert.fail("test case failed"); | ||
224 | - log.debug("not equal"); | ||
225 | - } | ||
226 | } | 198 | } |
227 | 199 | ||
200 | + /** | ||
201 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
202 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), | ||
203 | + * END-POINTS, ERO, LSPA objects in PcInitiate message. | ||
204 | + * | ||
205 | + * @throws PcepParseException when message paring fails | ||
206 | + */ | ||
228 | @Test | 207 | @Test |
229 | public void initiateMessageTest4() throws PcepParseException { | 208 | public void initiateMessageTest4() throws PcepParseException { |
230 | 209 | ||
... | @@ -256,13 +235,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -256,13 +235,10 @@ public class PcepInitiateMsgTest2 { |
256 | 235 | ||
257 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 236 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
258 | PcepMessage message = null; | 237 | PcepMessage message = null; |
259 | - try { | 238 | + |
260 | message = reader.readFrom(buffer); | 239 | message = reader.readFrom(buffer); |
261 | - } catch (PcepParseException e) { | ||
262 | - e.printStackTrace(); | ||
263 | - } | ||
264 | 240 | ||
265 | - if (message instanceof PcepInitiateMsg) { | 241 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
266 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 242 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
267 | message.writeTo(buf); | 243 | message.writeTo(buf); |
268 | testInitiateCreationMsg = buf.array(); | 244 | testInitiateCreationMsg = buf.array(); |
... | @@ -271,19 +247,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -271,19 +247,16 @@ public class PcepInitiateMsgTest2 { |
271 | testInitiateCreationMsg = new byte[iReadLen]; | 247 | testInitiateCreationMsg = new byte[iReadLen]; |
272 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 248 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
273 | 249 | ||
274 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 250 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
275 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
276 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
277 | - } else { | ||
278 | - Assert.fail("test case failed"); | ||
279 | - log.debug("not equal"); | ||
280 | - } | ||
281 | - } else { | ||
282 | - Assert.fail("test case failed"); | ||
283 | - log.debug("not equal"); | ||
284 | - } | ||
285 | } | 251 | } |
286 | 252 | ||
253 | + /** | ||
254 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
255 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA | ||
256 | + * objects in PcInitiate message. | ||
257 | + * | ||
258 | + * @throws PcepParseException when message paring fails | ||
259 | + */ | ||
287 | @Test | 260 | @Test |
288 | public void initiateMessageTest5() throws PcepParseException { | 261 | public void initiateMessageTest5() throws PcepParseException { |
289 | 262 | ||
... | @@ -313,13 +286,11 @@ public class PcepInitiateMsgTest2 { | ... | @@ -313,13 +286,11 @@ public class PcepInitiateMsgTest2 { |
313 | 286 | ||
314 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 287 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
315 | PcepMessage message = null; | 288 | PcepMessage message = null; |
316 | - try { | 289 | + |
317 | message = reader.readFrom(buffer); | 290 | message = reader.readFrom(buffer); |
318 | - } catch (PcepParseException e) { | ||
319 | - e.printStackTrace(); | ||
320 | - } | ||
321 | 291 | ||
322 | - if (message instanceof PcepInitiateMsg) { | 292 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
293 | + (message instanceof PcepInitiateMsg)); | ||
323 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 294 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
324 | message.writeTo(buf); | 295 | message.writeTo(buf); |
325 | testInitiateCreationMsg = buf.array(); | 296 | testInitiateCreationMsg = buf.array(); |
... | @@ -328,19 +299,18 @@ public class PcepInitiateMsgTest2 { | ... | @@ -328,19 +299,18 @@ public class PcepInitiateMsgTest2 { |
328 | testInitiateCreationMsg = new byte[iReadLen]; | 299 | testInitiateCreationMsg = new byte[iReadLen]; |
329 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 300 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
330 | 301 | ||
331 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 302 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
332 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 303 | + initiateCreationMsg, testInitiateCreationMsg); |
333 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 304 | + |
334 | - } else { | ||
335 | - Assert.fail("test case failed"); | ||
336 | - log.debug("not equal"); | ||
337 | - } | ||
338 | - } else { | ||
339 | - Assert.fail("test case failed"); | ||
340 | - log.debug("not equal"); | ||
341 | - } | ||
342 | } | 305 | } |
343 | 306 | ||
307 | + /** | ||
308 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
309 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, | ||
310 | + * BANDWIDTH OBJECT objects in PcInitiate message. | ||
311 | + * | ||
312 | + * @throws PcepParseException when message paring fails | ||
313 | + */ | ||
344 | @Test | 314 | @Test |
345 | public void initiateMessageTest6() throws PcepParseException { | 315 | public void initiateMessageTest6() throws PcepParseException { |
346 | 316 | ||
... | @@ -371,13 +341,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -371,13 +341,10 @@ public class PcepInitiateMsgTest2 { |
371 | 341 | ||
372 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 342 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
373 | PcepMessage message = null; | 343 | PcepMessage message = null; |
374 | - try { | 344 | + |
375 | message = reader.readFrom(buffer); | 345 | message = reader.readFrom(buffer); |
376 | - } catch (PcepParseException e) { | ||
377 | - e.printStackTrace(); | ||
378 | - } | ||
379 | 346 | ||
380 | - if (message instanceof PcepInitiateMsg) { | 347 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
381 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 348 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
382 | message.writeTo(buf); | 349 | message.writeTo(buf); |
383 | testInitiateCreationMsg = buf.array(); | 350 | testInitiateCreationMsg = buf.array(); |
... | @@ -386,19 +353,17 @@ public class PcepInitiateMsgTest2 { | ... | @@ -386,19 +353,17 @@ public class PcepInitiateMsgTest2 { |
386 | testInitiateCreationMsg = new byte[iReadLen]; | 353 | testInitiateCreationMsg = new byte[iReadLen]; |
387 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 354 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
388 | 355 | ||
389 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 356 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
390 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 357 | + |
391 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
392 | - } else { | ||
393 | - Assert.fail("test case failed"); | ||
394 | - log.debug("not equal"); | ||
395 | - } | ||
396 | - } else { | ||
397 | - Assert.fail("test case failed"); | ||
398 | - log.debug("not equal"); | ||
399 | - } | ||
400 | } | 358 | } |
401 | 359 | ||
360 | + /** | ||
361 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
362 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, | ||
363 | + * LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. | ||
364 | + * | ||
365 | + * @throws PcepParseException when message paring fails | ||
366 | + */ | ||
402 | @Test | 367 | @Test |
403 | public void initiateMessageTest7() throws PcepParseException { | 368 | public void initiateMessageTest7() throws PcepParseException { |
404 | 369 | ||
... | @@ -430,13 +395,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -430,13 +395,10 @@ public class PcepInitiateMsgTest2 { |
430 | 395 | ||
431 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 396 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
432 | PcepMessage message = null; | 397 | PcepMessage message = null; |
433 | - try { | 398 | + |
434 | message = reader.readFrom(buffer); | 399 | message = reader.readFrom(buffer); |
435 | - } catch (PcepParseException e) { | ||
436 | - e.printStackTrace(); | ||
437 | - } | ||
438 | 400 | ||
439 | - if (message instanceof PcepInitiateMsg) { | 401 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
440 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 402 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
441 | message.writeTo(buf); | 403 | message.writeTo(buf); |
442 | testInitiateCreationMsg = buf.array(); | 404 | testInitiateCreationMsg = buf.array(); |
... | @@ -445,19 +407,17 @@ public class PcepInitiateMsgTest2 { | ... | @@ -445,19 +407,17 @@ public class PcepInitiateMsgTest2 { |
445 | testInitiateCreationMsg = new byte[iReadLen]; | 407 | testInitiateCreationMsg = new byte[iReadLen]; |
446 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 408 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
447 | 409 | ||
448 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 410 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
449 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 411 | + |
450 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
451 | - } else { | ||
452 | - Assert.fail("test case failed"); | ||
453 | - log.debug("not equal"); | ||
454 | - } | ||
455 | - } else { | ||
456 | - Assert.fail("test case failed"); | ||
457 | - log.debug("not equal"); | ||
458 | - } | ||
459 | } | 412 | } |
460 | 413 | ||
414 | + /** | ||
415 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
416 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT | ||
417 | + * objects in PcInitiate message. | ||
418 | + * | ||
419 | + * @throws PcepParseException when message paring fails | ||
420 | + */ | ||
461 | @Test | 421 | @Test |
462 | public void initiateMessageTest8() throws PcepParseException { | 422 | public void initiateMessageTest8() throws PcepParseException { |
463 | 423 | ||
... | @@ -488,13 +448,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -488,13 +448,10 @@ public class PcepInitiateMsgTest2 { |
488 | 448 | ||
489 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 449 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
490 | PcepMessage message = null; | 450 | PcepMessage message = null; |
491 | - try { | 451 | + |
492 | message = reader.readFrom(buffer); | 452 | message = reader.readFrom(buffer); |
493 | - } catch (PcepParseException e) { | ||
494 | - e.printStackTrace(); | ||
495 | - } | ||
496 | 453 | ||
497 | - if (message instanceof PcepInitiateMsg) { | 454 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
498 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 455 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
499 | message.writeTo(buf); | 456 | message.writeTo(buf); |
500 | testInitiateCreationMsg = buf.array(); | 457 | testInitiateCreationMsg = buf.array(); |
... | @@ -503,19 +460,18 @@ public class PcepInitiateMsgTest2 { | ... | @@ -503,19 +460,18 @@ public class PcepInitiateMsgTest2 { |
503 | testInitiateCreationMsg = new byte[iReadLen]; | 460 | testInitiateCreationMsg = new byte[iReadLen]; |
504 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 461 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
505 | 462 | ||
506 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 463 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
507 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 464 | + initiateCreationMsg, testInitiateCreationMsg); |
508 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 465 | + |
509 | - } else { | ||
510 | - Assert.fail("test case failed"); | ||
511 | - log.debug("not equal"); | ||
512 | - } | ||
513 | - } else { | ||
514 | - Assert.fail("test case failed"); | ||
515 | - log.debug("not equal"); | ||
516 | - } | ||
517 | } | 466 | } |
518 | 467 | ||
468 | + /** | ||
469 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
470 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT | ||
471 | + * objects in PcInitiate message. | ||
472 | + * | ||
473 | + * @throws PcepParseException when message paring fails | ||
474 | + */ | ||
519 | @Test | 475 | @Test |
520 | public void initiateMessageTest9() throws PcepParseException { | 476 | public void initiateMessageTest9() throws PcepParseException { |
521 | 477 | ||
... | @@ -545,13 +501,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -545,13 +501,10 @@ public class PcepInitiateMsgTest2 { |
545 | 501 | ||
546 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 502 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
547 | PcepMessage message = null; | 503 | PcepMessage message = null; |
548 | - try { | 504 | + |
549 | message = reader.readFrom(buffer); | 505 | message = reader.readFrom(buffer); |
550 | - } catch (PcepParseException e) { | ||
551 | - e.printStackTrace(); | ||
552 | - } | ||
553 | 506 | ||
554 | - if (message instanceof PcepInitiateMsg) { | 507 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
555 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 508 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
556 | message.writeTo(buf); | 509 | message.writeTo(buf); |
557 | testInitiateCreationMsg = buf.array(); | 510 | testInitiateCreationMsg = buf.array(); |
... | @@ -560,19 +513,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -560,19 +513,16 @@ public class PcepInitiateMsgTest2 { |
560 | testInitiateCreationMsg = new byte[iReadLen]; | 513 | testInitiateCreationMsg = new byte[iReadLen]; |
561 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 514 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
562 | 515 | ||
563 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 516 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
564 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 517 | + |
565 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
566 | - } else { | ||
567 | - Assert.fail("test case failed"); | ||
568 | - log.debug("not equal"); | ||
569 | - } | ||
570 | - } else { | ||
571 | - Assert.fail("test case failed"); | ||
572 | - log.debug("not equal"); | ||
573 | - } | ||
574 | } | 518 | } |
575 | 519 | ||
520 | + /** | ||
521 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
522 | + * SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. | ||
523 | + * | ||
524 | + * @throws PcepParseException when message paring fails | ||
525 | + */ | ||
576 | @Test | 526 | @Test |
577 | public void initiateMessageTest10() throws PcepParseException { | 527 | public void initiateMessageTest10() throws PcepParseException { |
578 | 528 | ||
... | @@ -599,13 +549,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -599,13 +549,10 @@ public class PcepInitiateMsgTest2 { |
599 | 549 | ||
600 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 550 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
601 | PcepMessage message = null; | 551 | PcepMessage message = null; |
602 | - try { | 552 | + |
603 | message = reader.readFrom(buffer); | 553 | message = reader.readFrom(buffer); |
604 | - } catch (PcepParseException e) { | ||
605 | - e.printStackTrace(); | ||
606 | - } | ||
607 | 554 | ||
608 | - if (message instanceof PcepInitiateMsg) { | 555 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
609 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 556 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
610 | message.writeTo(buf); | 557 | message.writeTo(buf); |
611 | testInitiateCreationMsg = buf.array(); | 558 | testInitiateCreationMsg = buf.array(); |
... | @@ -614,19 +561,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -614,19 +561,16 @@ public class PcepInitiateMsgTest2 { |
614 | testInitiateCreationMsg = new byte[iReadLen]; | 561 | testInitiateCreationMsg = new byte[iReadLen]; |
615 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 562 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
616 | 563 | ||
617 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 564 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
618 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
619 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
620 | - } else { | ||
621 | - Assert.fail("test case failed"); | ||
622 | - log.debug("not equal"); | ||
623 | - } | ||
624 | - } else { | ||
625 | - Assert.fail("test case failed"); | ||
626 | - log.debug("not equal"); | ||
627 | - } | ||
628 | } | 565 | } |
629 | 566 | ||
567 | + /** | ||
568 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
569 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA OBJECT | ||
570 | + * objects in PcInitiate message. | ||
571 | + * | ||
572 | + * @throws PcepParseException when message paring fails | ||
573 | + */ | ||
630 | @Test | 574 | @Test |
631 | public void initiateMessageTest11() throws PcepParseException { | 575 | public void initiateMessageTest11() throws PcepParseException { |
632 | 576 | ||
... | @@ -655,13 +599,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -655,13 +599,10 @@ public class PcepInitiateMsgTest2 { |
655 | 599 | ||
656 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 600 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
657 | PcepMessage message = null; | 601 | PcepMessage message = null; |
658 | - try { | 602 | + |
659 | message = reader.readFrom(buffer); | 603 | message = reader.readFrom(buffer); |
660 | - } catch (PcepParseException e) { | ||
661 | - e.printStackTrace(); | ||
662 | - } | ||
663 | 604 | ||
664 | - if (message instanceof PcepInitiateMsg) { | 605 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
665 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 606 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
666 | message.writeTo(buf); | 607 | message.writeTo(buf); |
667 | 608 | ||
... | @@ -669,19 +610,17 @@ public class PcepInitiateMsgTest2 { | ... | @@ -669,19 +610,17 @@ public class PcepInitiateMsgTest2 { |
669 | testInitiateCreationMsg = new byte[iReadLen]; | 610 | testInitiateCreationMsg = new byte[iReadLen]; |
670 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 611 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
671 | 612 | ||
672 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 613 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
673 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 614 | + initiateCreationMsg, testInitiateCreationMsg); |
674 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
675 | - } else { | ||
676 | - Assert.fail("test case failed"); | ||
677 | - log.debug("not equal"); | ||
678 | - } | ||
679 | - } else { | ||
680 | - Assert.fail("test case failed"); | ||
681 | - log.debug("not equal"); | ||
682 | - } | ||
683 | } | 615 | } |
684 | 616 | ||
617 | + /** | ||
618 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
619 | + * SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT | ||
620 | + * objects in PcInitiate message. | ||
621 | + * | ||
622 | + * @throws PcepParseException when message paring fails | ||
623 | + */ | ||
685 | @Test | 624 | @Test |
686 | public void initiateMessageTest12() throws PcepParseException { | 625 | public void initiateMessageTest12() throws PcepParseException { |
687 | 626 | ||
... | @@ -709,13 +648,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -709,13 +648,10 @@ public class PcepInitiateMsgTest2 { |
709 | 648 | ||
710 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 649 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
711 | PcepMessage message = null; | 650 | PcepMessage message = null; |
712 | - try { | 651 | + |
713 | message = reader.readFrom(buffer); | 652 | message = reader.readFrom(buffer); |
714 | - } catch (PcepParseException e) { | ||
715 | - e.printStackTrace(); | ||
716 | - } | ||
717 | 653 | ||
718 | - if (message instanceof PcepInitiateMsg) { | 654 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
719 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 655 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
720 | message.writeTo(buf); | 656 | message.writeTo(buf); |
721 | testInitiateCreationMsg = buf.array(); | 657 | testInitiateCreationMsg = buf.array(); |
... | @@ -724,19 +660,17 @@ public class PcepInitiateMsgTest2 { | ... | @@ -724,19 +660,17 @@ public class PcepInitiateMsgTest2 { |
724 | testInitiateCreationMsg = new byte[iReadLen]; | 660 | testInitiateCreationMsg = new byte[iReadLen]; |
725 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 661 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
726 | 662 | ||
727 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 663 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
728 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 664 | + initiateCreationMsg, testInitiateCreationMsg); |
729 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
730 | - } else { | ||
731 | - Assert.fail("test case failed"); | ||
732 | - log.debug("not equal"); | ||
733 | - } | ||
734 | - } else { | ||
735 | - Assert.fail("test case failed"); | ||
736 | - log.debug("not equal"); | ||
737 | - } | ||
738 | } | 665 | } |
739 | 666 | ||
667 | + /** | ||
668 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, | ||
669 | + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT | ||
670 | + * objects in PcInitiate message. | ||
671 | + * | ||
672 | + * @throws PcepParseException when message paring fails | ||
673 | + */ | ||
740 | @Test | 674 | @Test |
741 | public void initiateMessageTest13() throws PcepParseException { | 675 | public void initiateMessageTest13() throws PcepParseException { |
742 | 676 | ||
... | @@ -765,13 +699,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -765,13 +699,10 @@ public class PcepInitiateMsgTest2 { |
765 | 699 | ||
766 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 700 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
767 | PcepMessage message = null; | 701 | PcepMessage message = null; |
768 | - try { | 702 | + |
769 | message = reader.readFrom(buffer); | 703 | message = reader.readFrom(buffer); |
770 | - } catch (PcepParseException e) { | ||
771 | - e.printStackTrace(); | ||
772 | - } | ||
773 | 704 | ||
774 | - if (message instanceof PcepInitiateMsg) { | 705 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
775 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 706 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
776 | message.writeTo(buf); | 707 | message.writeTo(buf); |
777 | testInitiateCreationMsg = buf.array(); | 708 | testInitiateCreationMsg = buf.array(); |
... | @@ -780,19 +711,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -780,19 +711,16 @@ public class PcepInitiateMsgTest2 { |
780 | testInitiateCreationMsg = new byte[iReadLen]; | 711 | testInitiateCreationMsg = new byte[iReadLen]; |
781 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 712 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
782 | 713 | ||
783 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 714 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
784 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 715 | + initiateCreationMsg, testInitiateCreationMsg); |
785 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
786 | - } else { | ||
787 | - Assert.fail("test case failed"); | ||
788 | - log.debug("not equal"); | ||
789 | - } | ||
790 | - } else { | ||
791 | - Assert.fail("test case failed"); | ||
792 | - log.debug("not equal"); | ||
793 | - } | ||
794 | } | 716 | } |
795 | 717 | ||
718 | + /** | ||
719 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), | ||
720 | + * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT objects in PcInitiate message. | ||
721 | + * | ||
722 | + * @throws PcepParseException when message paring fails | ||
723 | + */ | ||
796 | @Test | 724 | @Test |
797 | public void initiateMessageTest14() throws PcepParseException { | 725 | public void initiateMessageTest14() throws PcepParseException { |
798 | 726 | ||
... | @@ -820,13 +748,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -820,13 +748,10 @@ public class PcepInitiateMsgTest2 { |
820 | 748 | ||
821 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 749 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
822 | PcepMessage message = null; | 750 | PcepMessage message = null; |
823 | - try { | 751 | + |
824 | message = reader.readFrom(buffer); | 752 | message = reader.readFrom(buffer); |
825 | - } catch (PcepParseException e) { | ||
826 | - e.printStackTrace(); | ||
827 | - } | ||
828 | 753 | ||
829 | - if (message instanceof PcepInitiateMsg) { | 754 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
830 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 755 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
831 | message.writeTo(buf); | 756 | message.writeTo(buf); |
832 | testInitiateCreationMsg = buf.array(); | 757 | testInitiateCreationMsg = buf.array(); |
... | @@ -835,19 +760,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -835,19 +760,16 @@ public class PcepInitiateMsgTest2 { |
835 | testInitiateCreationMsg = new byte[iReadLen]; | 760 | testInitiateCreationMsg = new byte[iReadLen]; |
836 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 761 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
837 | 762 | ||
838 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 763 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
839 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 764 | + initiateCreationMsg, testInitiateCreationMsg); |
840 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
841 | - } else { | ||
842 | - Assert.fail("test case failed"); | ||
843 | - log.debug("not equal"); | ||
844 | - } | ||
845 | - } else { | ||
846 | - Assert.fail("test case failed"); | ||
847 | - log.debug("not equal"); | ||
848 | - } | ||
849 | } | 765 | } |
850 | 766 | ||
767 | + /** | ||
768 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), | ||
769 | + * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message. | ||
770 | + * | ||
771 | + * @throws PcepParseException when message paring fails | ||
772 | + */ | ||
851 | @Test | 773 | @Test |
852 | public void initiateMessageTest15() throws PcepParseException { | 774 | public void initiateMessageTest15() throws PcepParseException { |
853 | 775 | ||
... | @@ -874,13 +796,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -874,13 +796,10 @@ public class PcepInitiateMsgTest2 { |
874 | 796 | ||
875 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 797 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
876 | PcepMessage message = null; | 798 | PcepMessage message = null; |
877 | - try { | 799 | + |
878 | message = reader.readFrom(buffer); | 800 | message = reader.readFrom(buffer); |
879 | - } catch (PcepParseException e) { | ||
880 | - e.printStackTrace(); | ||
881 | - } | ||
882 | 801 | ||
883 | - if (message instanceof PcepInitiateMsg) { | 802 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
884 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 803 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
885 | message.writeTo(buf); | 804 | message.writeTo(buf); |
886 | testInitiateCreationMsg = buf.array(); | 805 | testInitiateCreationMsg = buf.array(); |
... | @@ -889,19 +808,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -889,19 +808,16 @@ public class PcepInitiateMsgTest2 { |
889 | testInitiateCreationMsg = new byte[iReadLen]; | 808 | testInitiateCreationMsg = new byte[iReadLen]; |
890 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 809 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
891 | 810 | ||
892 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 811 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
893 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 812 | + initiateCreationMsg, testInitiateCreationMsg); |
894 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
895 | - } else { | ||
896 | - Assert.fail("test case failed"); | ||
897 | - log.debug("not equal"); | ||
898 | - } | ||
899 | - } else { | ||
900 | - Assert.fail("test case failed"); | ||
901 | - log.debug("not equal"); | ||
902 | - } | ||
903 | } | 813 | } |
904 | 814 | ||
815 | + /** | ||
816 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), | ||
817 | + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. | ||
818 | + * | ||
819 | + * @throws PcepParseException when message paring fails | ||
820 | + */ | ||
905 | @Test | 821 | @Test |
906 | public void initiateMessageTest16() throws PcepParseException { | 822 | public void initiateMessageTest16() throws PcepParseException { |
907 | 823 | ||
... | @@ -927,13 +843,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -927,13 +843,10 @@ public class PcepInitiateMsgTest2 { |
927 | 843 | ||
928 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 844 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
929 | PcepMessage message = null; | 845 | PcepMessage message = null; |
930 | - try { | 846 | + |
931 | message = reader.readFrom(buffer); | 847 | message = reader.readFrom(buffer); |
932 | - } catch (PcepParseException e) { | ||
933 | - e.printStackTrace(); | ||
934 | - } | ||
935 | 848 | ||
936 | - if (message instanceof PcepInitiateMsg) { | 849 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
937 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 850 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
938 | message.writeTo(buf); | 851 | message.writeTo(buf); |
939 | testInitiateCreationMsg = buf.array(); | 852 | testInitiateCreationMsg = buf.array(); |
... | @@ -942,19 +855,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -942,19 +855,16 @@ public class PcepInitiateMsgTest2 { |
942 | testInitiateCreationMsg = new byte[iReadLen]; | 855 | testInitiateCreationMsg = new byte[iReadLen]; |
943 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 856 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
944 | 857 | ||
945 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 858 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
946 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 859 | + initiateCreationMsg, testInitiateCreationMsg); |
947 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
948 | - } else { | ||
949 | - Assert.fail("test case failed"); | ||
950 | - log.debug("not equal"); | ||
951 | - } | ||
952 | - } else { | ||
953 | - Assert.fail("test case failed"); | ||
954 | - log.debug("not equal"); | ||
955 | - } | ||
956 | } | 860 | } |
957 | 861 | ||
862 | + /** | ||
863 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT | ||
864 | + * objects in PcInitiate message. | ||
865 | + * | ||
866 | + * @throws PcepParseException when message paring fails | ||
867 | + */ | ||
958 | @Test | 868 | @Test |
959 | public void initiateMessageTest17() throws PcepParseException { | 869 | public void initiateMessageTest17() throws PcepParseException { |
960 | 870 | ||
... | @@ -978,13 +888,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -978,13 +888,10 @@ public class PcepInitiateMsgTest2 { |
978 | 888 | ||
979 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 889 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
980 | PcepMessage message = null; | 890 | PcepMessage message = null; |
981 | - try { | 891 | + |
982 | message = reader.readFrom(buffer); | 892 | message = reader.readFrom(buffer); |
983 | - } catch (PcepParseException e) { | ||
984 | - e.printStackTrace(); | ||
985 | - } | ||
986 | 893 | ||
987 | - if (message instanceof PcepInitiateMsg) { | 894 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
988 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 895 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
989 | message.writeTo(buf); | 896 | message.writeTo(buf); |
990 | testInitiateCreationMsg = buf.array(); | 897 | testInitiateCreationMsg = buf.array(); |
... | @@ -993,19 +900,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -993,19 +900,16 @@ public class PcepInitiateMsgTest2 { |
993 | testInitiateCreationMsg = new byte[iReadLen]; | 900 | testInitiateCreationMsg = new byte[iReadLen]; |
994 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 901 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
995 | 902 | ||
996 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 903 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
997 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 904 | + initiateCreationMsg, testInitiateCreationMsg); |
998 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
999 | - } else { | ||
1000 | - Assert.fail("test case failed"); | ||
1001 | - log.debug("not equal"); | ||
1002 | - } | ||
1003 | - } else { | ||
1004 | - Assert.fail("test case failed"); | ||
1005 | - log.debug("not equal"); | ||
1006 | - } | ||
1007 | } | 905 | } |
1008 | 906 | ||
907 | + /** | ||
908 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, | ||
909 | + * BANDWIDTH OBJECT objects in PcInitiate message. | ||
910 | + * | ||
911 | + * @throws PcepParseException when message paring fails | ||
912 | + */ | ||
1009 | @Test | 913 | @Test |
1010 | public void initiateMessageTest18() throws PcepParseException { | 914 | public void initiateMessageTest18() throws PcepParseException { |
1011 | 915 | ||
... | @@ -1030,13 +934,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1030,13 +934,10 @@ public class PcepInitiateMsgTest2 { |
1030 | 934 | ||
1031 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 935 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1032 | PcepMessage message = null; | 936 | PcepMessage message = null; |
1033 | - try { | 937 | + |
1034 | message = reader.readFrom(buffer); | 938 | message = reader.readFrom(buffer); |
1035 | - } catch (PcepParseException e) { | ||
1036 | - e.printStackTrace(); | ||
1037 | - } | ||
1038 | 939 | ||
1039 | - if (message instanceof PcepInitiateMsg) { | 940 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1040 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 941 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1041 | message.writeTo(buf); | 942 | message.writeTo(buf); |
1042 | testInitiateCreationMsg = buf.array(); | 943 | testInitiateCreationMsg = buf.array(); |
... | @@ -1045,19 +946,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1045,19 +946,16 @@ public class PcepInitiateMsgTest2 { |
1045 | testInitiateCreationMsg = new byte[iReadLen]; | 946 | testInitiateCreationMsg = new byte[iReadLen]; |
1046 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 947 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1047 | 948 | ||
1048 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 949 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1049 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 950 | + initiateCreationMsg, testInitiateCreationMsg); |
1050 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1051 | - } else { | ||
1052 | - Assert.fail("test case failed"); | ||
1053 | - log.debug("not equal"); | ||
1054 | - } | ||
1055 | - } else { | ||
1056 | - Assert.fail("test case failed"); | ||
1057 | - log.debug("not equal"); | ||
1058 | - } | ||
1059 | } | 951 | } |
1060 | 952 | ||
953 | + /** | ||
954 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, | ||
955 | + * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. | ||
956 | + * | ||
957 | + * @throws PcepParseException when message paring fails | ||
958 | + */ | ||
1061 | @Test | 959 | @Test |
1062 | public void initiateMessageTest19() throws PcepParseException { | 960 | public void initiateMessageTest19() throws PcepParseException { |
1063 | 961 | ||
... | @@ -1083,13 +981,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1083,13 +981,10 @@ public class PcepInitiateMsgTest2 { |
1083 | 981 | ||
1084 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 982 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1085 | PcepMessage message = null; | 983 | PcepMessage message = null; |
1086 | - try { | 984 | + |
1087 | message = reader.readFrom(buffer); | 985 | message = reader.readFrom(buffer); |
1088 | - } catch (PcepParseException e) { | ||
1089 | - e.printStackTrace(); | ||
1090 | - } | ||
1091 | 986 | ||
1092 | - if (message instanceof PcepInitiateMsg) { | 987 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1093 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 988 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1094 | message.writeTo(buf); | 989 | message.writeTo(buf); |
1095 | testInitiateCreationMsg = buf.array(); | 990 | testInitiateCreationMsg = buf.array(); |
... | @@ -1098,19 +993,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1098,19 +993,15 @@ public class PcepInitiateMsgTest2 { |
1098 | testInitiateCreationMsg = new byte[iReadLen]; | 993 | testInitiateCreationMsg = new byte[iReadLen]; |
1099 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 994 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1100 | 995 | ||
1101 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 996 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1102 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1103 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1104 | - } else { | ||
1105 | - Assert.fail("test case failed"); | ||
1106 | - log.debug("not equal"); | ||
1107 | - } | ||
1108 | - } else { | ||
1109 | - Assert.fail("test case failed"); | ||
1110 | - log.debug("not equal"); | ||
1111 | - } | ||
1112 | } | 997 | } |
1113 | 998 | ||
999 | + /** | ||
1000 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, | ||
1001 | + * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. | ||
1002 | + * | ||
1003 | + * @throws PcepParseException when message paring fails | ||
1004 | + */ | ||
1114 | @Test | 1005 | @Test |
1115 | public void initiateMessageTest20() throws PcepParseException { | 1006 | public void initiateMessageTest20() throws PcepParseException { |
1116 | 1007 | ||
... | @@ -1135,13 +1026,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1135,13 +1026,10 @@ public class PcepInitiateMsgTest2 { |
1135 | 1026 | ||
1136 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1027 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1137 | PcepMessage message = null; | 1028 | PcepMessage message = null; |
1138 | - try { | 1029 | + |
1139 | message = reader.readFrom(buffer); | 1030 | message = reader.readFrom(buffer); |
1140 | - } catch (PcepParseException e) { | ||
1141 | - e.printStackTrace(); | ||
1142 | - } | ||
1143 | 1031 | ||
1144 | - if (message instanceof PcepInitiateMsg) { | 1032 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1145 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1033 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1146 | message.writeTo(buf); | 1034 | message.writeTo(buf); |
1147 | testInitiateCreationMsg = buf.array(); | 1035 | testInitiateCreationMsg = buf.array(); |
... | @@ -1150,19 +1038,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1150,19 +1038,16 @@ public class PcepInitiateMsgTest2 { |
1150 | testInitiateCreationMsg = new byte[iReadLen]; | 1038 | testInitiateCreationMsg = new byte[iReadLen]; |
1151 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1039 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1152 | 1040 | ||
1153 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1041 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1154 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1042 | + initiateCreationMsg, testInitiateCreationMsg); |
1155 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1156 | - } else { | ||
1157 | - Assert.fail("test case failed"); | ||
1158 | - log.debug("not equal"); | ||
1159 | - } | ||
1160 | - } else { | ||
1161 | - Assert.fail("test case failed"); | ||
1162 | - log.debug("not equal"); | ||
1163 | - } | ||
1164 | } | 1043 | } |
1165 | 1044 | ||
1045 | + /** | ||
1046 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, | ||
1047 | + * BANDWIDTH OBJECT objects in PcInitiate message. | ||
1048 | + * | ||
1049 | + * @throws PcepParseException when message paring fails | ||
1050 | + */ | ||
1166 | @Test | 1051 | @Test |
1167 | public void initiateMessageTest21() throws PcepParseException { | 1052 | public void initiateMessageTest21() throws PcepParseException { |
1168 | 1053 | ||
... | @@ -1186,13 +1071,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1186,13 +1071,10 @@ public class PcepInitiateMsgTest2 { |
1186 | 1071 | ||
1187 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1072 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1188 | PcepMessage message = null; | 1073 | PcepMessage message = null; |
1189 | - try { | 1074 | + |
1190 | message = reader.readFrom(buffer); | 1075 | message = reader.readFrom(buffer); |
1191 | - } catch (PcepParseException e) { | ||
1192 | - e.printStackTrace(); | ||
1193 | - } | ||
1194 | 1076 | ||
1195 | - if (message instanceof PcepInitiateMsg) { | 1077 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1196 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1078 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1197 | message.writeTo(buf); | 1079 | message.writeTo(buf); |
1198 | testInitiateCreationMsg = buf.array(); | 1080 | testInitiateCreationMsg = buf.array(); |
... | @@ -1201,19 +1083,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1201,19 +1083,15 @@ public class PcepInitiateMsgTest2 { |
1201 | testInitiateCreationMsg = new byte[iReadLen]; | 1083 | testInitiateCreationMsg = new byte[iReadLen]; |
1202 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1084 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1203 | 1085 | ||
1204 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1086 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1205 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1206 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1207 | - } else { | ||
1208 | - Assert.fail("test case failed"); | ||
1209 | - log.debug("not equal"); | ||
1210 | - } | ||
1211 | - } else { | ||
1212 | - Assert.fail("test case failed"); | ||
1213 | - log.debug("not equal"); | ||
1214 | - } | ||
1215 | } | 1087 | } |
1216 | 1088 | ||
1089 | + /** | ||
1090 | + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, | ||
1091 | + * LSPA OBJECT objects in PcInitiate message. | ||
1092 | + * | ||
1093 | + * @throws PcepParseException when message paring fails | ||
1094 | + */ | ||
1217 | @Test | 1095 | @Test |
1218 | public void initiateMessageTest22() throws PcepParseException { | 1096 | public void initiateMessageTest22() throws PcepParseException { |
1219 | 1097 | ||
... | @@ -1236,13 +1114,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1236,13 +1114,10 @@ public class PcepInitiateMsgTest2 { |
1236 | 1114 | ||
1237 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1115 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1238 | PcepMessage message = null; | 1116 | PcepMessage message = null; |
1239 | - try { | 1117 | + |
1240 | message = reader.readFrom(buffer); | 1118 | message = reader.readFrom(buffer); |
1241 | - } catch (PcepParseException e) { | ||
1242 | - e.printStackTrace(); | ||
1243 | - } | ||
1244 | 1119 | ||
1245 | - if (message instanceof PcepInitiateMsg) { | 1120 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1246 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1121 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1247 | message.writeTo(buf); | 1122 | message.writeTo(buf); |
1248 | testInitiateCreationMsg = buf.array(); | 1123 | testInitiateCreationMsg = buf.array(); |
... | @@ -1251,19 +1126,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1251,19 +1126,16 @@ public class PcepInitiateMsgTest2 { |
1251 | testInitiateCreationMsg = new byte[iReadLen]; | 1126 | testInitiateCreationMsg = new byte[iReadLen]; |
1252 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1127 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1253 | 1128 | ||
1254 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1129 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1255 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1130 | + initiateCreationMsg, testInitiateCreationMsg); |
1256 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1257 | - } else { | ||
1258 | - Assert.fail("test case failed"); | ||
1259 | - log.debug("not equal"); | ||
1260 | - } | ||
1261 | - } else { | ||
1262 | - Assert.fail("test case failed"); | ||
1263 | - log.debug("not equal"); | ||
1264 | - } | ||
1265 | } | 1131 | } |
1266 | 1132 | ||
1133 | + /** | ||
1134 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), | ||
1135 | + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. | ||
1136 | + * | ||
1137 | + * @throws PcepParseException when message paring fails | ||
1138 | + */ | ||
1267 | @Test | 1139 | @Test |
1268 | public void initiateMessageTest23() throws PcepParseException { | 1140 | public void initiateMessageTest23() throws PcepParseException { |
1269 | 1141 | ||
... | @@ -1287,13 +1159,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1287,13 +1159,10 @@ public class PcepInitiateMsgTest2 { |
1287 | 1159 | ||
1288 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1160 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1289 | PcepMessage message = null; | 1161 | PcepMessage message = null; |
1290 | - try { | 1162 | + |
1291 | message = reader.readFrom(buffer); | 1163 | message = reader.readFrom(buffer); |
1292 | - } catch (PcepParseException e) { | ||
1293 | - e.printStackTrace(); | ||
1294 | - } | ||
1295 | 1164 | ||
1296 | - if (message instanceof PcepInitiateMsg) { | 1165 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1297 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1166 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1298 | message.writeTo(buf); | 1167 | message.writeTo(buf); |
1299 | testInitiateCreationMsg = buf.array(); | 1168 | testInitiateCreationMsg = buf.array(); |
... | @@ -1302,19 +1171,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1302,19 +1171,16 @@ public class PcepInitiateMsgTest2 { |
1302 | testInitiateCreationMsg = new byte[iReadLen]; | 1171 | testInitiateCreationMsg = new byte[iReadLen]; |
1303 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1172 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1304 | 1173 | ||
1305 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1174 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1306 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1175 | + initiateCreationMsg, testInitiateCreationMsg); |
1307 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1308 | - } else { | ||
1309 | - Assert.fail("test case failed"); | ||
1310 | - log.debug("not equal"); | ||
1311 | - } | ||
1312 | - } else { | ||
1313 | - Assert.fail("test case failed"); | ||
1314 | - log.debug("not equal"); | ||
1315 | - } | ||
1316 | } | 1176 | } |
1317 | 1177 | ||
1178 | + /** | ||
1179 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), | ||
1180 | + * END-POINTS, ERO, LSPA BANDWIDTH OBJECT objects in PcInitiate message. | ||
1181 | + * | ||
1182 | + * @throws PcepParseException when message paring fails | ||
1183 | + */ | ||
1318 | @Test | 1184 | @Test |
1319 | public void initiateMessageTest25() throws PcepParseException { | 1185 | public void initiateMessageTest25() throws PcepParseException { |
1320 | 1186 | ||
... | @@ -1339,13 +1205,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1339,13 +1205,10 @@ public class PcepInitiateMsgTest2 { |
1339 | 1205 | ||
1340 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1206 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1341 | PcepMessage message = null; | 1207 | PcepMessage message = null; |
1342 | - try { | 1208 | + |
1343 | message = reader.readFrom(buffer); | 1209 | message = reader.readFrom(buffer); |
1344 | - } catch (PcepParseException e) { | ||
1345 | - e.printStackTrace(); | ||
1346 | - } | ||
1347 | 1210 | ||
1348 | - if (message instanceof PcepInitiateMsg) { | 1211 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1349 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1212 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1350 | message.writeTo(buf); | 1213 | message.writeTo(buf); |
1351 | testInitiateCreationMsg = buf.array(); | 1214 | testInitiateCreationMsg = buf.array(); |
... | @@ -1354,19 +1217,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1354,19 +1217,16 @@ public class PcepInitiateMsgTest2 { |
1354 | testInitiateCreationMsg = new byte[iReadLen]; | 1217 | testInitiateCreationMsg = new byte[iReadLen]; |
1355 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1218 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1356 | 1219 | ||
1357 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1220 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1358 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1221 | + initiateCreationMsg, testInitiateCreationMsg); |
1359 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1360 | - } else { | ||
1361 | - Assert.fail("test case failed"); | ||
1362 | - log.debug("not equal"); | ||
1363 | - } | ||
1364 | - } else { | ||
1365 | - Assert.fail("test case failed"); | ||
1366 | - log.debug("not equal"); | ||
1367 | - } | ||
1368 | } | 1222 | } |
1369 | 1223 | ||
1224 | + /** | ||
1225 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, | ||
1226 | + * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. | ||
1227 | + * | ||
1228 | + * @throws PcepParseException when message paring fails | ||
1229 | + */ | ||
1370 | @Test | 1230 | @Test |
1371 | public void initiateMessageTest26() throws PcepParseException { | 1231 | public void initiateMessageTest26() throws PcepParseException { |
1372 | 1232 | ||
... | @@ -1393,13 +1253,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1393,13 +1253,10 @@ public class PcepInitiateMsgTest2 { |
1393 | 1253 | ||
1394 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1254 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1395 | PcepMessage message = null; | 1255 | PcepMessage message = null; |
1396 | - try { | 1256 | + |
1397 | message = reader.readFrom(buffer); | 1257 | message = reader.readFrom(buffer); |
1398 | - } catch (PcepParseException e) { | ||
1399 | - e.printStackTrace(); | ||
1400 | - } | ||
1401 | 1258 | ||
1402 | - if (message instanceof PcepInitiateMsg) { | 1259 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1403 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1260 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1404 | message.writeTo(buf); | 1261 | message.writeTo(buf); |
1405 | testInitiateCreationMsg = buf.array(); | 1262 | testInitiateCreationMsg = buf.array(); |
... | @@ -1408,19 +1265,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1408,19 +1265,16 @@ public class PcepInitiateMsgTest2 { |
1408 | testInitiateCreationMsg = new byte[iReadLen]; | 1265 | testInitiateCreationMsg = new byte[iReadLen]; |
1409 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1266 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1410 | 1267 | ||
1411 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1268 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1412 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1269 | + initiateCreationMsg, testInitiateCreationMsg); |
1413 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1414 | - } else { | ||
1415 | - Assert.fail("test case failed"); | ||
1416 | - log.debug("not equal"); | ||
1417 | - } | ||
1418 | - } else { | ||
1419 | - Assert.fail("test case failed"); | ||
1420 | - log.debug("not equal"); | ||
1421 | - } | ||
1422 | } | 1270 | } |
1423 | 1271 | ||
1272 | + /** | ||
1273 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, | ||
1274 | + * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. | ||
1275 | + * | ||
1276 | + * @throws PcepParseException when message paring fails | ||
1277 | + */ | ||
1424 | @Test | 1278 | @Test |
1425 | public void initiateMessageTest27() throws PcepParseException { | 1279 | public void initiateMessageTest27() throws PcepParseException { |
1426 | 1280 | ||
... | @@ -1444,13 +1298,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1444,13 +1298,10 @@ public class PcepInitiateMsgTest2 { |
1444 | 1298 | ||
1445 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1299 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1446 | PcepMessage message = null; | 1300 | PcepMessage message = null; |
1447 | - try { | 1301 | + |
1448 | message = reader.readFrom(buffer); | 1302 | message = reader.readFrom(buffer); |
1449 | - } catch (PcepParseException e) { | ||
1450 | - e.printStackTrace(); | ||
1451 | - } | ||
1452 | 1303 | ||
1453 | - if (message instanceof PcepInitiateMsg) { | 1304 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1454 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1305 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1455 | message.writeTo(buf); | 1306 | message.writeTo(buf); |
1456 | testInitiateCreationMsg = buf.array(); | 1307 | testInitiateCreationMsg = buf.array(); |
... | @@ -1459,19 +1310,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1459,19 +1310,15 @@ public class PcepInitiateMsgTest2 { |
1459 | testInitiateCreationMsg = new byte[iReadLen]; | 1310 | testInitiateCreationMsg = new byte[iReadLen]; |
1460 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1311 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1461 | 1312 | ||
1462 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1313 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1463 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1464 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1465 | - } else { | ||
1466 | - Assert.fail("test case failed"); | ||
1467 | - log.debug("not equal"); | ||
1468 | - } | ||
1469 | - } else { | ||
1470 | - Assert.fail("test case failed"); | ||
1471 | - log.debug("not equal"); | ||
1472 | - } | ||
1473 | } | 1314 | } |
1474 | 1315 | ||
1316 | + /** | ||
1317 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, | ||
1318 | + * LSPA, BANDWIDTH OBJECT objects in PcInitiate message. | ||
1319 | + * | ||
1320 | + * @throws PcepParseException when message paring fails | ||
1321 | + */ | ||
1475 | @Test | 1322 | @Test |
1476 | public void initiateMessageTest28() throws PcepParseException { | 1323 | public void initiateMessageTest28() throws PcepParseException { |
1477 | 1324 | ||
... | @@ -1494,13 +1341,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1494,13 +1341,10 @@ public class PcepInitiateMsgTest2 { |
1494 | 1341 | ||
1495 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1342 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1496 | PcepMessage message = null; | 1343 | PcepMessage message = null; |
1497 | - try { | 1344 | + |
1498 | message = reader.readFrom(buffer); | 1345 | message = reader.readFrom(buffer); |
1499 | - } catch (PcepParseException e) { | ||
1500 | - e.printStackTrace(); | ||
1501 | - } | ||
1502 | 1346 | ||
1503 | - if (message instanceof PcepInitiateMsg) { | 1347 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1504 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1348 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1505 | message.writeTo(buf); | 1349 | message.writeTo(buf); |
1506 | testInitiateCreationMsg = buf.array(); | 1350 | testInitiateCreationMsg = buf.array(); |
... | @@ -1509,19 +1353,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1509,19 +1353,16 @@ public class PcepInitiateMsgTest2 { |
1509 | testInitiateCreationMsg = new byte[iReadLen]; | 1353 | testInitiateCreationMsg = new byte[iReadLen]; |
1510 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1354 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1511 | 1355 | ||
1512 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1356 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1513 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1357 | + initiateCreationMsg, testInitiateCreationMsg); |
1514 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1515 | - } else { | ||
1516 | - Assert.fail("test case failed"); | ||
1517 | - log.debug("not equal"); | ||
1518 | - } | ||
1519 | - } else { | ||
1520 | - Assert.fail("test case failed"); | ||
1521 | - log.debug("not equal"); | ||
1522 | - } | ||
1523 | } | 1358 | } |
1524 | 1359 | ||
1360 | + /** | ||
1361 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), | ||
1362 | + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. | ||
1363 | + * | ||
1364 | + * @throws PcepParseException when message paring fails | ||
1365 | + */ | ||
1525 | @Test | 1366 | @Test |
1526 | public void initiateMessageTest29() throws PcepParseException { | 1367 | public void initiateMessageTest29() throws PcepParseException { |
1527 | 1368 | ||
... | @@ -1543,13 +1384,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1543,13 +1384,10 @@ public class PcepInitiateMsgTest2 { |
1543 | 1384 | ||
1544 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1385 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1545 | PcepMessage message = null; | 1386 | PcepMessage message = null; |
1546 | - try { | 1387 | + |
1547 | message = reader.readFrom(buffer); | 1388 | message = reader.readFrom(buffer); |
1548 | - } catch (PcepParseException e) { | ||
1549 | - e.printStackTrace(); | ||
1550 | - } | ||
1551 | 1389 | ||
1552 | - if (message instanceof PcepInitiateMsg) { | 1390 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1553 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1391 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1554 | message.writeTo(buf); | 1392 | message.writeTo(buf); |
1555 | testInitiateCreationMsg = buf.array(); | 1393 | testInitiateCreationMsg = buf.array(); |
... | @@ -1558,19 +1396,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1558,19 +1396,15 @@ public class PcepInitiateMsgTest2 { |
1558 | testInitiateCreationMsg = new byte[iReadLen]; | 1396 | testInitiateCreationMsg = new byte[iReadLen]; |
1559 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1397 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1560 | 1398 | ||
1561 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1399 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1562 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1563 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1564 | - } else { | ||
1565 | - Assert.fail("test case failed"); | ||
1566 | - log.debug("not equal"); | ||
1567 | - } | ||
1568 | - } else { | ||
1569 | - Assert.fail("test case failed"); | ||
1570 | - log.debug("not equal"); | ||
1571 | - } | ||
1572 | } | 1400 | } |
1573 | 1401 | ||
1402 | + /** | ||
1403 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), | ||
1404 | + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. | ||
1405 | + * | ||
1406 | + * @throws PcepParseException when message paring fails | ||
1407 | + */ | ||
1574 | @Test | 1408 | @Test |
1575 | public void initiateMessageTest30() throws PcepParseException { | 1409 | public void initiateMessageTest30() throws PcepParseException { |
1576 | 1410 | ||
... | @@ -1593,13 +1427,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1593,13 +1427,10 @@ public class PcepInitiateMsgTest2 { |
1593 | 1427 | ||
1594 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1428 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1595 | PcepMessage message = null; | 1429 | PcepMessage message = null; |
1596 | - try { | 1430 | + |
1597 | message = reader.readFrom(buffer); | 1431 | message = reader.readFrom(buffer); |
1598 | - } catch (PcepParseException e) { | ||
1599 | - e.printStackTrace(); | ||
1600 | - } | ||
1601 | 1432 | ||
1602 | - if (message instanceof PcepInitiateMsg) { | 1433 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1603 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1434 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1604 | message.writeTo(buf); | 1435 | message.writeTo(buf); |
1605 | testInitiateCreationMsg = buf.array(); | 1436 | testInitiateCreationMsg = buf.array(); |
... | @@ -1608,19 +1439,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1608,19 +1439,15 @@ public class PcepInitiateMsgTest2 { |
1608 | testInitiateCreationMsg = new byte[iReadLen]; | 1439 | testInitiateCreationMsg = new byte[iReadLen]; |
1609 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1440 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1610 | 1441 | ||
1611 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1442 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1612 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1613 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1614 | - } else { | ||
1615 | - Assert.fail("test case failed"); | ||
1616 | - log.debug("not equal"); | ||
1617 | - } | ||
1618 | - } else { | ||
1619 | - Assert.fail("test case failed"); | ||
1620 | - log.debug("not equal"); | ||
1621 | - } | ||
1622 | } | 1443 | } |
1623 | 1444 | ||
1445 | + /** | ||
1446 | + * This test case checks for SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT | ||
1447 | + * objects in PcInitiate message. | ||
1448 | + * | ||
1449 | + * @throws PcepParseException when message paring fails | ||
1450 | + */ | ||
1624 | @Test | 1451 | @Test |
1625 | public void initiateMessageTest31() throws PcepParseException { | 1452 | public void initiateMessageTest31() throws PcepParseException { |
1626 | 1453 | ||
... | @@ -1642,13 +1469,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1642,13 +1469,10 @@ public class PcepInitiateMsgTest2 { |
1642 | 1469 | ||
1643 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1470 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1644 | PcepMessage message = null; | 1471 | PcepMessage message = null; |
1645 | - try { | 1472 | + |
1646 | message = reader.readFrom(buffer); | 1473 | message = reader.readFrom(buffer); |
1647 | - } catch (PcepParseException e) { | ||
1648 | - e.printStackTrace(); | ||
1649 | - } | ||
1650 | 1474 | ||
1651 | - if (message instanceof PcepInitiateMsg) { | 1475 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1652 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1476 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1653 | message.writeTo(buf); | 1477 | message.writeTo(buf); |
1654 | testInitiateCreationMsg = buf.array(); | 1478 | testInitiateCreationMsg = buf.array(); |
... | @@ -1657,19 +1481,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1657,19 +1481,15 @@ public class PcepInitiateMsgTest2 { |
1657 | testInitiateCreationMsg = new byte[iReadLen]; | 1481 | testInitiateCreationMsg = new byte[iReadLen]; |
1658 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1482 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1659 | 1483 | ||
1660 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1484 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1661 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1662 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1663 | - } else { | ||
1664 | - Assert.fail("test case failed"); | ||
1665 | - log.debug("not equal"); | ||
1666 | - } | ||
1667 | - } else { | ||
1668 | - Assert.fail("test case failed"); | ||
1669 | - log.debug("not equal"); | ||
1670 | - } | ||
1671 | } | 1485 | } |
1672 | 1486 | ||
1487 | + /** | ||
1488 | + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, | ||
1489 | + * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. | ||
1490 | + * | ||
1491 | + * @throws PcepParseException when message paring fails | ||
1492 | + */ | ||
1673 | @Test | 1493 | @Test |
1674 | public void initiateMessageTest32() throws PcepParseException { | 1494 | public void initiateMessageTest32() throws PcepParseException { |
1675 | 1495 | ||
... | @@ -1695,13 +1515,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1695,13 +1515,10 @@ public class PcepInitiateMsgTest2 { |
1695 | 1515 | ||
1696 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1516 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1697 | PcepMessage message = null; | 1517 | PcepMessage message = null; |
1698 | - try { | 1518 | + |
1699 | message = reader.readFrom(buffer); | 1519 | message = reader.readFrom(buffer); |
1700 | - } catch (PcepParseException e) { | ||
1701 | - e.printStackTrace(); | ||
1702 | - } | ||
1703 | 1520 | ||
1704 | - if (message instanceof PcepInitiateMsg) { | 1521 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1705 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1522 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1706 | message.writeTo(buf); | 1523 | message.writeTo(buf); |
1707 | testInitiateCreationMsg = buf.array(); | 1524 | testInitiateCreationMsg = buf.array(); |
... | @@ -1710,19 +1527,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1710,19 +1527,16 @@ public class PcepInitiateMsgTest2 { |
1710 | testInitiateCreationMsg = new byte[iReadLen]; | 1527 | testInitiateCreationMsg = new byte[iReadLen]; |
1711 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1528 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1712 | 1529 | ||
1713 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1530 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1714 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1531 | + |
1715 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1716 | - } else { | ||
1717 | - Assert.fail("test case failed"); | ||
1718 | - log.debug("not equal"); | ||
1719 | - } | ||
1720 | - } else { | ||
1721 | - Assert.fail("test case failed"); | ||
1722 | - log.debug("not equal"); | ||
1723 | - } | ||
1724 | } | 1532 | } |
1725 | 1533 | ||
1534 | + /** | ||
1535 | + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, | ||
1536 | + * ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message. | ||
1537 | + * | ||
1538 | + * @throws PcepParseException when message paring fails | ||
1539 | + */ | ||
1726 | @Test | 1540 | @Test |
1727 | public void initiateMessageTest33() throws PcepParseException { | 1541 | public void initiateMessageTest33() throws PcepParseException { |
1728 | 1542 | ||
... | @@ -1747,13 +1561,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1747,13 +1561,10 @@ public class PcepInitiateMsgTest2 { |
1747 | 1561 | ||
1748 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1562 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1749 | PcepMessage message = null; | 1563 | PcepMessage message = null; |
1750 | - try { | 1564 | + |
1751 | message = reader.readFrom(buffer); | 1565 | message = reader.readFrom(buffer); |
1752 | - } catch (PcepParseException e) { | ||
1753 | - e.printStackTrace(); | ||
1754 | - } | ||
1755 | 1566 | ||
1756 | - if (message instanceof PcepInitiateMsg) { | 1567 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1757 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1568 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1758 | message.writeTo(buf); | 1569 | message.writeTo(buf); |
1759 | testInitiateCreationMsg = buf.array(); | 1570 | testInitiateCreationMsg = buf.array(); |
... | @@ -1762,19 +1573,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1762,19 +1573,16 @@ public class PcepInitiateMsgTest2 { |
1762 | testInitiateCreationMsg = new byte[iReadLen]; | 1573 | testInitiateCreationMsg = new byte[iReadLen]; |
1763 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1574 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1764 | 1575 | ||
1765 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1576 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1766 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1577 | + initiateCreationMsg, testInitiateCreationMsg); |
1767 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1768 | - } else { | ||
1769 | - Assert.fail("test case failed"); | ||
1770 | - log.debug("not equal"); | ||
1771 | - } | ||
1772 | - } else { | ||
1773 | - Assert.fail("test case failed"); | ||
1774 | - log.debug("not equal"); | ||
1775 | - } | ||
1776 | } | 1578 | } |
1777 | 1579 | ||
1580 | + /** | ||
1581 | + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, | ||
1582 | + * ERO, LSPA OBJECT objects in PcInitiate message. | ||
1583 | + * | ||
1584 | + * @throws PcepParseException when message paring fails | ||
1585 | + */ | ||
1778 | @Test | 1586 | @Test |
1779 | public void initiateMessageTest34() throws PcepParseException { | 1587 | public void initiateMessageTest34() throws PcepParseException { |
1780 | 1588 | ||
... | @@ -1798,13 +1606,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1798,13 +1606,10 @@ public class PcepInitiateMsgTest2 { |
1798 | 1606 | ||
1799 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1607 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1800 | PcepMessage message = null; | 1608 | PcepMessage message = null; |
1801 | - try { | 1609 | + |
1802 | message = reader.readFrom(buffer); | 1610 | message = reader.readFrom(buffer); |
1803 | - } catch (PcepParseException e) { | ||
1804 | - e.printStackTrace(); | ||
1805 | - } | ||
1806 | 1611 | ||
1807 | - if (message instanceof PcepInitiateMsg) { | 1612 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1808 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1613 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1809 | message.writeTo(buf); | 1614 | message.writeTo(buf); |
1810 | testInitiateCreationMsg = buf.array(); | 1615 | testInitiateCreationMsg = buf.array(); |
... | @@ -1813,19 +1618,15 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1813,19 +1618,15 @@ public class PcepInitiateMsgTest2 { |
1813 | testInitiateCreationMsg = new byte[iReadLen]; | 1618 | testInitiateCreationMsg = new byte[iReadLen]; |
1814 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1619 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1815 | 1620 | ||
1816 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1621 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1817 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1818 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1819 | - } else { | ||
1820 | - Assert.fail("test case failed"); | ||
1821 | - log.debug("not equal"); | ||
1822 | - } | ||
1823 | - } else { | ||
1824 | - Assert.fail("test case failed"); | ||
1825 | - log.debug("not equal"); | ||
1826 | - } | ||
1827 | } | 1622 | } |
1828 | 1623 | ||
1624 | + /** | ||
1625 | + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, | ||
1626 | + * ERO, LSPA OBJECT objects in PcInitiate message. | ||
1627 | + * | ||
1628 | + * @throws PcepParseException when message paring fails | ||
1629 | + */ | ||
1829 | @Test | 1630 | @Test |
1830 | public void initiateMessageTest35() throws PcepParseException { | 1631 | public void initiateMessageTest35() throws PcepParseException { |
1831 | 1632 | ||
... | @@ -1850,13 +1651,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1850,13 +1651,10 @@ public class PcepInitiateMsgTest2 { |
1850 | 1651 | ||
1851 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1652 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1852 | PcepMessage message = null; | 1653 | PcepMessage message = null; |
1853 | - try { | 1654 | + |
1854 | message = reader.readFrom(buffer); | 1655 | message = reader.readFrom(buffer); |
1855 | - } catch (PcepParseException e) { | ||
1856 | - e.printStackTrace(); | ||
1857 | - } | ||
1858 | 1656 | ||
1859 | - if (message instanceof PcepInitiateMsg) { | 1657 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1860 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1658 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1861 | message.writeTo(buf); | 1659 | message.writeTo(buf); |
1862 | testInitiateCreationMsg = buf.array(); | 1660 | testInitiateCreationMsg = buf.array(); |
... | @@ -1865,19 +1663,16 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1865,19 +1663,16 @@ public class PcepInitiateMsgTest2 { |
1865 | testInitiateCreationMsg = new byte[iReadLen]; | 1663 | testInitiateCreationMsg = new byte[iReadLen]; |
1866 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1664 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1867 | 1665 | ||
1868 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1666 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1869 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1667 | + initiateCreationMsg, testInitiateCreationMsg); |
1870 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
1871 | - } else { | ||
1872 | - Assert.fail("test case failed"); | ||
1873 | - log.debug("not equal"); | ||
1874 | - } | ||
1875 | - } else { | ||
1876 | - Assert.fail("test case failed"); | ||
1877 | - log.debug("not equal"); | ||
1878 | - } | ||
1879 | } | 1668 | } |
1880 | 1669 | ||
1670 | + /** | ||
1671 | + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, | ||
1672 | + * ERO, LSPA OBJECT objects in PcInitiate message. | ||
1673 | + * | ||
1674 | + * @throws PcepParseException when message paring fails | ||
1675 | + */ | ||
1881 | @Test | 1676 | @Test |
1882 | public void initiateMessageTest36() throws PcepParseException { | 1677 | public void initiateMessageTest36() throws PcepParseException { |
1883 | 1678 | ||
... | @@ -1901,13 +1696,10 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1901,13 +1696,10 @@ public class PcepInitiateMsgTest2 { |
1901 | 1696 | ||
1902 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 1697 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
1903 | PcepMessage message = null; | 1698 | PcepMessage message = null; |
1904 | - try { | 1699 | + |
1905 | message = reader.readFrom(buffer); | 1700 | message = reader.readFrom(buffer); |
1906 | - } catch (PcepParseException e) { | ||
1907 | - e.printStackTrace(); | ||
1908 | - } | ||
1909 | 1701 | ||
1910 | - if (message instanceof PcepInitiateMsg) { | 1702 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1911 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1703 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1912 | message.writeTo(buf); | 1704 | message.writeTo(buf); |
1913 | testInitiateCreationMsg = buf.array(); | 1705 | testInitiateCreationMsg = buf.array(); |
... | @@ -1916,17 +1708,9 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1916,17 +1708,9 @@ public class PcepInitiateMsgTest2 { |
1916 | testInitiateCreationMsg = new byte[iReadLen]; | 1708 | testInitiateCreationMsg = new byte[iReadLen]; |
1917 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1709 | buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1918 | 1710 | ||
1919 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1711 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1920 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | 1712 | + initiateCreationMsg, testInitiateCreationMsg); |
1921 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | 1713 | + |
1922 | - } else { | ||
1923 | - Assert.fail("test case failed"); | ||
1924 | - log.debug("not equal"); | ||
1925 | - } | ||
1926 | - } else { | ||
1927 | - Assert.fail("test case failed"); | ||
1928 | - log.debug("not equal"); | ||
1929 | - } | ||
1930 | } | 1714 | } |
1931 | } | 1715 | } |
1932 | 1716 | ... | ... |
-
Please register or login to post a comment