Committed by
Gerrit Code Review
PcIntiateMsg UT updated for adding javadoc, remove log and if check
Change-Id: Ie15db6bd2af729091779b186f1c84e2b411ab058
Showing
2 changed files
with
1281 additions
and
1638 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,34 +58,29 @@ public class PcepInitiateMsgTest { | ... | @@ -68,34 +58,29 @@ 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) { | 63 | + |
74 | - e.printStackTrace(); | 64 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
75 | - } | 65 | + (message instanceof PcepInitiateMsg)); |
76 | - | 66 | + |
77 | - if (message instanceof PcepInitiateMsg) { | 67 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
78 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 68 | + message.writeTo(buf); |
79 | - message.writeTo(buf); | 69 | + testInitiateCreationMsg = buf.array(); |
80 | - testInitiateCreationMsg = buf.array(); | 70 | + |
81 | - | 71 | + int iReadLen = buf.writerIndex() - 0; |
82 | - int iReadLen = buf.writerIndex() - 0; | 72 | + testInitiateCreationMsg = new byte[iReadLen]; |
83 | - testInitiateCreationMsg = new byte[iReadLen]; | 73 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
84 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 74 | + |
85 | - | 75 | + Assert.assertArrayEquals("PCInitiate messages are not equal ", initiateCreationMsg, testInitiateCreationMsg); |
86 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 76 | + |
87 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +99,31 @@ public class PcepInitiateMsgTest { | ... | @@ -114,34 +99,31 @@ 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) { | 104 | + |
120 | - e.printStackTrace(); | 105 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
121 | - } | 106 | + (message instanceof PcepInitiateMsg)); |
122 | - | 107 | + |
123 | - if (message instanceof PcepInitiateMsg) { | 108 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
124 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 109 | + message.writeTo(buf); |
125 | - message.writeTo(buf); | 110 | + testInitiateDeletionMsg = buf.array(); |
126 | - testInitiateDeletionMsg = buf.array(); | 111 | + |
127 | - | 112 | + int iReadLen = buf.writerIndex() - 0; |
128 | - int iReadLen = buf.writerIndex() - 0; | 113 | + testInitiateDeletionMsg = new byte[iReadLen]; |
129 | - testInitiateDeletionMsg = new byte[iReadLen]; | 114 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
130 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 115 | + |
131 | - | 116 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
132 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 117 | + initiateDeletionMsg, testInitiateDeletionMsg); |
133 | - Assert.assertArrayEquals(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,34 +150,29 @@ public class PcepInitiateMsgTest { | ... | @@ -168,34 +150,29 @@ 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) { | 155 | + |
174 | - e.printStackTrace(); | 156 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
175 | - } | 157 | + (message instanceof PcepInitiateMsg)); |
176 | - | 158 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
177 | - if (message instanceof PcepInitiateMsg) { | 159 | + message.writeTo(buf); |
178 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 160 | + testInitiateCreationMsg = buf.array(); |
179 | - message.writeTo(buf); | 161 | + |
180 | - testInitiateCreationMsg = buf.array(); | 162 | + int iReadLen = buf.writerIndex() - 0; |
181 | - | 163 | + testInitiateCreationMsg = new byte[iReadLen]; |
182 | - int iReadLen = buf.writerIndex() - 0; | 164 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
183 | - testInitiateCreationMsg = new byte[iReadLen]; | 165 | + |
184 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 166 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
185 | - | 167 | + |
186 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
187 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +199,29 @@ public class PcepInitiateMsgTest { | ... | @@ -222,34 +199,29 @@ 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) { | 204 | + |
228 | - e.printStackTrace(); | 205 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
229 | - } | 206 | + (message instanceof PcepInitiateMsg)); |
230 | - | 207 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
231 | - if (message instanceof PcepInitiateMsg) { | 208 | + message.writeTo(buf); |
232 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 209 | + testInitiateCreationMsg = buf.array(); |
233 | - message.writeTo(buf); | 210 | + |
234 | - testInitiateCreationMsg = buf.array(); | 211 | + int iReadLen = buf.writerIndex() - 0; |
235 | - | 212 | + testInitiateCreationMsg = new byte[iReadLen]; |
236 | - int iReadLen = buf.writerIndex() - 0; | 213 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
237 | - testInitiateCreationMsg = new byte[iReadLen]; | 214 | + |
238 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 215 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
239 | - | 216 | + initiateCreationMsg, testInitiateCreationMsg); |
240 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
241 | - Assert.assertArrayEquals(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,34 +247,29 @@ public class PcepInitiateMsgTest { | ... | @@ -275,34 +247,29 @@ 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) { | 252 | + |
281 | - e.printStackTrace(); | 253 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
282 | - } | 254 | + (message instanceof PcepInitiateMsg)); |
283 | - | 255 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
284 | - if (message instanceof PcepInitiateMsg) { | 256 | + message.writeTo(buf); |
285 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 257 | + testInitiateCreationMsg = buf.array(); |
286 | - message.writeTo(buf); | 258 | + |
287 | - testInitiateCreationMsg = buf.array(); | 259 | + int iReadLen = buf.writerIndex() - 0; |
288 | - | 260 | + testInitiateCreationMsg = new byte[iReadLen]; |
289 | - int iReadLen = buf.writerIndex() - 0; | 261 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
290 | - testInitiateCreationMsg = new byte[iReadLen]; | 262 | + |
291 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 263 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
292 | - | 264 | + initiateCreationMsg, testInitiateCreationMsg); |
293 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
294 | - Assert.assertArrayEquals(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,34 +295,29 @@ public class PcepInitiateMsgTest { | ... | @@ -328,34 +295,29 @@ 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) { | 300 | + |
334 | - e.printStackTrace(); | 301 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
335 | - } | 302 | + (message instanceof PcepInitiateMsg)); |
336 | - | 303 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
337 | - if (message instanceof PcepInitiateMsg) { | 304 | + message.writeTo(buf); |
338 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 305 | + testInitiateCreationMsg = buf.array(); |
339 | - message.writeTo(buf); | 306 | + |
340 | - testInitiateCreationMsg = buf.array(); | 307 | + int iReadLen = buf.writerIndex() - 0; |
341 | - | 308 | + testInitiateCreationMsg = new byte[iReadLen]; |
342 | - int iReadLen = buf.writerIndex() - 0; | 309 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
343 | - testInitiateCreationMsg = new byte[iReadLen]; | 310 | + |
344 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 311 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
345 | - | 312 | + initiateCreationMsg, testInitiateCreationMsg); |
346 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
347 | - Assert.assertArrayEquals(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,34 +342,29 @@ public class PcepInitiateMsgTest { | ... | @@ -380,34 +342,29 @@ 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) { | 347 | + |
386 | - e.printStackTrace(); | 348 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
387 | - } | 349 | + (message instanceof PcepInitiateMsg)); |
388 | - | 350 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
389 | - if (message instanceof PcepInitiateMsg) { | 351 | + message.writeTo(buf); |
390 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 352 | + testInitiateCreationMsg = buf.array(); |
391 | - message.writeTo(buf); | 353 | + |
392 | - testInitiateCreationMsg = buf.array(); | 354 | + int iReadLen = buf.writerIndex() - 0; |
393 | - | 355 | + testInitiateCreationMsg = new byte[iReadLen]; |
394 | - int iReadLen = buf.writerIndex() - 0; | 356 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
395 | - testInitiateCreationMsg = new byte[iReadLen]; | 357 | + |
396 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 358 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
397 | - | 359 | + initiateCreationMsg, testInitiateCreationMsg); |
398 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
399 | - Assert.assertArrayEquals(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,34 +388,29 @@ public class PcepInitiateMsgTest { | ... | @@ -431,34 +388,29 @@ 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) { | 393 | + |
437 | - e.printStackTrace(); | 394 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
438 | - } | 395 | + (message instanceof PcepInitiateMsg)); |
439 | - | 396 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
440 | - if (message instanceof PcepInitiateMsg) { | 397 | + message.writeTo(buf); |
441 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 398 | + testInitiateCreationMsg = buf.array(); |
442 | - message.writeTo(buf); | 399 | + |
443 | - testInitiateCreationMsg = buf.array(); | 400 | + int iReadLen = buf.writerIndex() - 0; |
444 | - | 401 | + testInitiateCreationMsg = new byte[iReadLen]; |
445 | - int iReadLen = buf.writerIndex() - 0; | 402 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
446 | - testInitiateCreationMsg = new byte[iReadLen]; | 403 | + |
447 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 404 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
448 | - | 405 | + initiateCreationMsg, testInitiateCreationMsg); |
449 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
450 | - Assert.assertArrayEquals(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,34 +432,29 @@ public class PcepInitiateMsgTest { | ... | @@ -480,34 +432,29 @@ 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) { | 437 | + |
486 | - e.printStackTrace(); | 438 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
487 | - } | 439 | + (message instanceof PcepInitiateMsg)); |
488 | - | 440 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
489 | - if (message instanceof PcepInitiateMsg) { | 441 | + message.writeTo(buf); |
490 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 442 | + testInitiateCreationMsg = buf.array(); |
491 | - message.writeTo(buf); | 443 | + |
492 | - testInitiateCreationMsg = buf.array(); | 444 | + int iReadLen = buf.writerIndex() - 0; |
493 | - | 445 | + testInitiateCreationMsg = new byte[iReadLen]; |
494 | - int iReadLen = buf.writerIndex() - 0; | 446 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
495 | - testInitiateCreationMsg = new byte[iReadLen]; | 447 | + |
496 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 448 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
497 | - | 449 | + initiateCreationMsg, testInitiateCreationMsg); |
498 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
499 | - Assert.assertArrayEquals(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,34 +476,29 @@ public class PcepInitiateMsgTest { | ... | @@ -529,34 +476,29 @@ 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) { | 481 | + |
535 | - e.printStackTrace(); | 482 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
536 | - } | 483 | + (message instanceof PcepInitiateMsg)); |
537 | - | 484 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
538 | - if (message instanceof PcepInitiateMsg) { | 485 | + message.writeTo(buf); |
539 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 486 | + testInitiateDeletionMsg = buf.array(); |
540 | - message.writeTo(buf); | 487 | + |
541 | - testInitiateDeletionMsg = buf.array(); | 488 | + int iReadLen = buf.writerIndex() - 0; |
542 | - | 489 | + testInitiateDeletionMsg = new byte[iReadLen]; |
543 | - int iReadLen = buf.writerIndex() - 0; | 490 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
544 | - testInitiateDeletionMsg = new byte[iReadLen]; | 491 | + |
545 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 492 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
546 | - | 493 | + initiateDeletionMsg, testInitiateDeletionMsg); |
547 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | ||
548 | - Assert.assertArrayEquals(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,34 +520,30 @@ public class PcepInitiateMsgTest { | ... | @@ -578,34 +520,30 @@ 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) { | 525 | + |
584 | - e.printStackTrace(); | 526 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
585 | - } | 527 | + (message instanceof PcepInitiateMsg)); |
586 | - | 528 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
587 | - if (message instanceof PcepInitiateMsg) { | 529 | + message.writeTo(buf); |
588 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 530 | + testInitiateDeletionMsg = buf.array(); |
589 | - message.writeTo(buf); | 531 | + |
590 | - testInitiateDeletionMsg = buf.array(); | 532 | + int iReadLen = buf.writerIndex() - 0; |
591 | - | 533 | + testInitiateDeletionMsg = new byte[iReadLen]; |
592 | - int iReadLen = buf.writerIndex() - 0; | 534 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
593 | - testInitiateDeletionMsg = new byte[iReadLen]; | 535 | + |
594 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 536 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
595 | - | 537 | + initiateDeletionMsg, testInitiateDeletionMsg); |
596 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 538 | + |
597 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | ||
598 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
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,34 +564,29 @@ public class PcepInitiateMsgTest { | ... | @@ -626,34 +564,29 @@ 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) { | 569 | + |
632 | - e.printStackTrace(); | 570 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
633 | - } | 571 | + (message instanceof PcepInitiateMsg)); |
634 | - | 572 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
635 | - if (message instanceof PcepInitiateMsg) { | 573 | + message.writeTo(buf); |
636 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 574 | + testInitiateDeletionMsg = buf.array(); |
637 | - message.writeTo(buf); | 575 | + |
638 | - testInitiateDeletionMsg = buf.array(); | 576 | + int iReadLen = buf.writerIndex() - 0; |
639 | - | 577 | + testInitiateDeletionMsg = new byte[iReadLen]; |
640 | - int iReadLen = buf.writerIndex() - 0; | 578 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
641 | - testInitiateDeletionMsg = new byte[iReadLen]; | 579 | + |
642 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 580 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
643 | - | 581 | + initiateDeletionMsg, testInitiateDeletionMsg); |
644 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | ||
645 | - Assert.assertArrayEquals(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,34 +606,29 @@ public class PcepInitiateMsgTest { | ... | @@ -673,34 +606,29 @@ 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) { | 611 | + |
679 | - e.printStackTrace(); | 612 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
680 | - } | 613 | + (message instanceof PcepInitiateMsg)); |
681 | - | 614 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
682 | - if (message instanceof PcepInitiateMsg) { | 615 | + message.writeTo(buf); |
683 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 616 | + testInitiateDeletionMsg = buf.array(); |
684 | - message.writeTo(buf); | 617 | + |
685 | - testInitiateDeletionMsg = buf.array(); | 618 | + int iReadLen = buf.writerIndex() - 0; |
686 | - | 619 | + testInitiateDeletionMsg = new byte[iReadLen]; |
687 | - int iReadLen = buf.writerIndex() - 0; | 620 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
688 | - testInitiateDeletionMsg = new byte[iReadLen]; | 621 | + |
689 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 622 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
690 | - | 623 | + initiateDeletionMsg, testInitiateDeletionMsg); |
691 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | ||
692 | - Assert.assertArrayEquals(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,34 +648,30 @@ public class PcepInitiateMsgTest { | ... | @@ -720,34 +648,30 @@ 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) { | 653 | + |
726 | - e.printStackTrace(); | 654 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
727 | - } | 655 | + (message instanceof PcepInitiateMsg)); |
728 | - | 656 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
729 | - if (message instanceof PcepInitiateMsg) { | 657 | + message.writeTo(buf); |
730 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 658 | + testInitiateDeletionMsg = buf.array(); |
731 | - message.writeTo(buf); | 659 | + |
732 | - testInitiateDeletionMsg = buf.array(); | 660 | + int iReadLen = buf.writerIndex() - 0; |
733 | - | 661 | + testInitiateDeletionMsg = new byte[iReadLen]; |
734 | - int iReadLen = buf.writerIndex() - 0; | 662 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
735 | - testInitiateDeletionMsg = new byte[iReadLen]; | 663 | + |
736 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 664 | + Assert.assertArrayEquals("PcInitiate(with R flag set) messages are not equal", |
737 | - | 665 | + initiateDeletionMsg, testInitiateDeletionMsg); |
738 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 666 | + |
739 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | ||
740 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
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,34 +690,29 @@ public class PcepInitiateMsgTest { | ... | @@ -766,34 +690,29 @@ 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) { | 695 | + |
772 | - e.printStackTrace(); | 696 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
773 | - } | 697 | + (message instanceof PcepInitiateMsg)); |
774 | - | 698 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
775 | - if (message instanceof PcepInitiateMsg) { | 699 | + message.writeTo(buf); |
776 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 700 | + testInitiateDeletionMsg = buf.array(); |
777 | - message.writeTo(buf); | 701 | + |
778 | - testInitiateDeletionMsg = buf.array(); | 702 | + int iReadLen = buf.writerIndex() - 0; |
779 | - | 703 | + testInitiateDeletionMsg = new byte[iReadLen]; |
780 | - int iReadLen = buf.writerIndex() - 0; | 704 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
781 | - testInitiateDeletionMsg = new byte[iReadLen]; | 705 | + |
782 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 706 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateDeletionMsg, testInitiateDeletionMsg); |
783 | - | 707 | + |
784 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | ||
785 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | ||
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,34 +734,29 @@ public class PcepInitiateMsgTest { | ... | @@ -815,34 +734,29 @@ 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) { | 739 | + |
821 | - e.printStackTrace(); | 740 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
822 | - } | 741 | + (message instanceof PcepInitiateMsg)); |
823 | - | 742 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
824 | - if (message instanceof PcepInitiateMsg) { | 743 | + message.writeTo(buf); |
825 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 744 | + testInitiateCreationMsg = buf.array(); |
826 | - message.writeTo(buf); | 745 | + |
827 | - testInitiateCreationMsg = buf.array(); | 746 | + int iReadLen = buf.writerIndex() - 0; |
828 | - | 747 | + testInitiateCreationMsg = new byte[iReadLen]; |
829 | - int iReadLen = buf.writerIndex() - 0; | 748 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
830 | - testInitiateCreationMsg = new byte[iReadLen]; | 749 | + |
831 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 750 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
832 | - | 751 | + initiateCreationMsg, testInitiateCreationMsg); |
833 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
834 | - Assert.assertArrayEquals(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,34 +779,29 @@ public class PcepInitiateMsgTest { | ... | @@ -865,34 +779,29 @@ 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) { | 784 | + |
871 | - e.printStackTrace(); | 785 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
872 | - } | 786 | + (message instanceof PcepInitiateMsg)); |
873 | - | 787 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
874 | - if (message instanceof PcepInitiateMsg) { | 788 | + message.writeTo(buf); |
875 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 789 | + testInitiateCreationMsg = buf.array(); |
876 | - message.writeTo(buf); | 790 | + |
877 | - testInitiateCreationMsg = buf.array(); | 791 | + int iReadLen = buf.writerIndex() - 0; |
878 | - | 792 | + testInitiateCreationMsg = new byte[iReadLen]; |
879 | - int iReadLen = buf.writerIndex() - 0; | 793 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
880 | - testInitiateCreationMsg = new byte[iReadLen]; | 794 | + |
881 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 795 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
882 | - | 796 | + |
883 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
884 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +824,30 @@ public class PcepInitiateMsgTest { | ... | @@ -915,34 +824,30 @@ 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) { | 829 | + |
921 | - e.printStackTrace(); | 830 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
922 | - } | 831 | + (message instanceof PcepInitiateMsg)); |
923 | - | 832 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
924 | - if (message instanceof PcepInitiateMsg) { | 833 | + message.writeTo(buf); |
925 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 834 | + testInitiateCreationMsg = buf.array(); |
926 | - message.writeTo(buf); | 835 | + |
927 | - testInitiateCreationMsg = buf.array(); | 836 | + int iReadLen = buf.writerIndex() - 0; |
928 | - | 837 | + testInitiateCreationMsg = new byte[iReadLen]; |
929 | - int iReadLen = buf.writerIndex() - 0; | 838 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
930 | - testInitiateCreationMsg = new byte[iReadLen]; | 839 | + |
931 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 840 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
932 | - | 841 | + initiateCreationMsg, testInitiateCreationMsg); |
933 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 842 | + |
934 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
935 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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,34 +872,29 @@ public class PcepInitiateMsgTest { | ... | @@ -967,34 +872,29 @@ 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) { | 877 | + |
973 | - e.printStackTrace(); | 878 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
974 | - } | 879 | + (message instanceof PcepInitiateMsg)); |
975 | - | 880 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
976 | - if (message instanceof PcepInitiateMsg) { | 881 | + message.writeTo(buf); |
977 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 882 | + testInitiateCreationMsg = buf.array(); |
978 | - message.writeTo(buf); | 883 | + |
979 | - testInitiateCreationMsg = buf.array(); | 884 | + int iReadLen = buf.writerIndex() - 0; |
980 | - | 885 | + testInitiateCreationMsg = new byte[iReadLen]; |
981 | - int iReadLen = buf.writerIndex() - 0; | 886 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
982 | - testInitiateCreationMsg = new byte[iReadLen]; | 887 | + |
983 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 888 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
984 | - | 889 | + initiateCreationMsg, testInitiateCreationMsg); |
985 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
986 | - Assert.assertArrayEquals(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,34 +920,30 @@ public class PcepInitiateMsgTest { | ... | @@ -1020,34 +920,30 @@ 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) { | 925 | + |
1026 | - e.printStackTrace(); | 926 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1027 | - } | 927 | + (message instanceof PcepInitiateMsg)); |
1028 | - | 928 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1029 | - if (message instanceof PcepInitiateMsg) { | 929 | + message.writeTo(buf); |
1030 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 930 | + testInitiateDeletionMsg = buf.array(); |
1031 | - message.writeTo(buf); | 931 | + |
1032 | - testInitiateDeletionMsg = buf.array(); | 932 | + int iReadLen = buf.writerIndex() - 0; |
1033 | - | 933 | + testInitiateDeletionMsg = new byte[iReadLen]; |
1034 | - int iReadLen = buf.writerIndex() - 0; | 934 | + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); |
1035 | - testInitiateDeletionMsg = new byte[iReadLen]; | 935 | + |
1036 | - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); | 936 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1037 | - | 937 | + initiateDeletionMsg, testInitiateDeletionMsg); |
1038 | - if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) { | 938 | + |
1039 | - Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg); | ||
1040 | - log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg); | ||
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,34 +975,30 @@ public class PcepInitiateMsgTest { | ... | @@ -1079,34 +975,30 @@ 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) { | 980 | + |
1085 | - e.printStackTrace(); | 981 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1086 | - } | 982 | + (message instanceof PcepInitiateMsg)); |
1087 | - | 983 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1088 | - if (message instanceof PcepInitiateMsg) { | 984 | + message.writeTo(buf); |
1089 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 985 | + testInitiateCreationMsg = buf.array(); |
1090 | - message.writeTo(buf); | 986 | + |
1091 | - testInitiateCreationMsg = buf.array(); | 987 | + int iReadLen = buf.writerIndex() - 0; |
1092 | - | 988 | + testInitiateCreationMsg = new byte[iReadLen]; |
1093 | - int iReadLen = buf.writerIndex() - 0; | 989 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1094 | - testInitiateCreationMsg = new byte[iReadLen]; | 990 | + |
1095 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 991 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1096 | - | 992 | + initiateCreationMsg, testInitiateCreationMsg); |
1097 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 993 | + |
1098 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1099 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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,34 +1032,28 @@ public class PcepInitiateMsgTest { | ... | @@ -1140,34 +1032,28 @@ 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 { | 1035 | + message = reader.readFrom(buffer); |
1144 | - message = reader.readFrom(buffer); | 1036 | + |
1145 | - } catch (PcepParseException e) { | 1037 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1146 | - e.printStackTrace(); | 1038 | + (message instanceof PcepInitiateMsg)); |
1147 | - } | 1039 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1148 | - | 1040 | + message.writeTo(buf); |
1149 | - if (message instanceof PcepInitiateMsg) { | 1041 | + testInitiateCreationMsg = buf.array(); |
1150 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1042 | + |
1151 | - message.writeTo(buf); | 1043 | + int iReadLen = buf.writerIndex() - 0; |
1152 | - testInitiateCreationMsg = buf.array(); | 1044 | + testInitiateCreationMsg = new byte[iReadLen]; |
1153 | - | 1045 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1154 | - int iReadLen = buf.writerIndex() - 0; | 1046 | + |
1155 | - testInitiateCreationMsg = new byte[iReadLen]; | 1047 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1156 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1048 | + |
1157 | - | ||
1158 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1159 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +1088,29 @@ public class PcepInitiateMsgTest { | ... | @@ -1202,34 +1088,29 @@ 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) { | 1093 | + |
1208 | - e.printStackTrace(); | 1094 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1209 | - } | 1095 | + (message instanceof PcepInitiateMsg)); |
1210 | - | 1096 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1211 | - if (message instanceof PcepInitiateMsg) { | 1097 | + message.writeTo(buf); |
1212 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1098 | + testInitiateCreationMsg = buf.array(); |
1213 | - message.writeTo(buf); | 1099 | + |
1214 | - testInitiateCreationMsg = buf.array(); | 1100 | + int iReadLen = buf.writerIndex() - 0; |
1215 | - | 1101 | + testInitiateCreationMsg = new byte[iReadLen]; |
1216 | - int iReadLen = buf.writerIndex() - 0; | 1102 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1217 | - testInitiateCreationMsg = new byte[iReadLen]; | 1103 | + |
1218 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1104 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1219 | - | 1105 | + initiateCreationMsg, testInitiateCreationMsg); |
1220 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1221 | - Assert.assertArrayEquals(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,34 +1145,29 @@ public class PcepInitiateMsgTest { | ... | @@ -1264,34 +1145,29 @@ 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) { | 1150 | + |
1270 | - e.printStackTrace(); | 1151 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1271 | - } | 1152 | + (message instanceof PcepInitiateMsg)); |
1272 | - | 1153 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1273 | - if (message instanceof PcepInitiateMsg) { | 1154 | + message.writeTo(buf); |
1274 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1155 | + testInitiateCreationMsg = buf.array(); |
1275 | - message.writeTo(buf); | 1156 | + |
1276 | - testInitiateCreationMsg = buf.array(); | 1157 | + int iReadLen = buf.writerIndex() - 0; |
1277 | - | 1158 | + testInitiateCreationMsg = new byte[iReadLen]; |
1278 | - int iReadLen = buf.writerIndex() - 0; | 1159 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1279 | - testInitiateCreationMsg = new byte[iReadLen]; | 1160 | + |
1280 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1161 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1281 | - | ||
1282 | - if (Arrays.equals(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,34 +1205,31 @@ public class PcepInitiateMsgTest { | ... | @@ -1329,34 +1205,31 @@ 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) { | 1210 | + |
1335 | - e.printStackTrace(); | 1211 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1336 | - } | 1212 | + (message instanceof PcepInitiateMsg)); |
1337 | - | 1213 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1338 | - if (message instanceof PcepInitiateMsg) { | 1214 | + message.writeTo(buf); |
1339 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1215 | + testInitiateCreationMsg = buf.array(); |
1340 | - message.writeTo(buf); | 1216 | + |
1341 | - testInitiateCreationMsg = buf.array(); | 1217 | + int iReadLen = buf.writerIndex() - 0; |
1342 | - | 1218 | + testInitiateCreationMsg = new byte[iReadLen]; |
1343 | - int iReadLen = buf.writerIndex() - 0; | 1219 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1344 | - testInitiateCreationMsg = new byte[iReadLen]; | 1220 | + |
1345 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1221 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1346 | - | 1222 | + initiateCreationMsg, testInitiateCreationMsg); |
1347 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1223 | + |
1348 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1349 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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,34 +1268,31 @@ public class PcepInitiateMsgTest { | ... | @@ -1395,34 +1268,31 @@ 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) { | 1273 | + |
1401 | - e.printStackTrace(); | 1274 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1402 | - } | 1275 | + (message instanceof PcepInitiateMsg)); |
1403 | - | 1276 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1404 | - if (message instanceof PcepInitiateMsg) { | 1277 | + message.writeTo(buf); |
1405 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1278 | + testInitiateCreationMsg = buf.array(); |
1406 | - message.writeTo(buf); | 1279 | + |
1407 | - testInitiateCreationMsg = buf.array(); | 1280 | + int iReadLen = buf.writerIndex() - 0; |
1408 | - | 1281 | + testInitiateCreationMsg = new byte[iReadLen]; |
1409 | - int iReadLen = buf.writerIndex() - 0; | 1282 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1410 | - testInitiateCreationMsg = new byte[iReadLen]; | 1283 | + |
1411 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1284 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1412 | - | 1285 | + initiateCreationMsg, testInitiateCreationMsg); |
1413 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 1286 | + |
1414 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1415 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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,31 +1333,20 @@ public class PcepInitiateMsgTest { | ... | @@ -1463,31 +1333,20 @@ 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) { | 1338 | + |
1469 | - e.printStackTrace(); | 1339 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
1470 | - } | 1340 | + (message instanceof PcepInitiateMsg)); |
1471 | - | 1341 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1472 | - if (message instanceof PcepInitiateMsg) { | 1342 | + message.writeTo(buf); |
1473 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1343 | + testInitiateCreationMsg = buf.array(); |
1474 | - message.writeTo(buf); | 1344 | + |
1475 | - testInitiateCreationMsg = buf.array(); | 1345 | + int iReadLen = buf.writerIndex() - 0; |
1476 | - | 1346 | + testInitiateCreationMsg = new byte[iReadLen]; |
1477 | - int iReadLen = buf.writerIndex() - 0; | 1347 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1478 | - testInitiateCreationMsg = new byte[iReadLen]; | 1348 | + |
1479 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1349 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1480 | - | 1350 | + initiateCreationMsg, testInitiateCreationMsg); |
1481 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1482 | - Assert.assertArrayEquals(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,34 +70,30 @@ public class PcepInitiateMsgTest2 { | ... | @@ -76,34 +70,30 @@ 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) { | 75 | + |
82 | - e.printStackTrace(); | 76 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
83 | - } | 77 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
84 | - | 78 | + message.writeTo(buf); |
85 | - if (message instanceof PcepInitiateMsg) { | 79 | + testInitiateCreationMsg = buf.array(); |
86 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 80 | + |
87 | - message.writeTo(buf); | 81 | + int iReadLen = buf.writerIndex() - 0; |
88 | - testInitiateCreationMsg = buf.array(); | 82 | + testInitiateCreationMsg = new byte[iReadLen]; |
89 | - | 83 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
90 | - int iReadLen = buf.writerIndex() - 0; | 84 | + |
91 | - testInitiateCreationMsg = new byte[iReadLen]; | 85 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
92 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 86 | + |
93 | - | ||
94 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
95 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +127,29 @@ public class PcepInitiateMsgTest2 { | ... | @@ -137,34 +127,29 @@ 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) { | 132 | + |
143 | - e.printStackTrace(); | 133 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
144 | - } | 134 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
145 | - | 135 | + message.writeTo(buf); |
146 | - if (message instanceof PcepInitiateMsg) { | 136 | + testInitiateCreationMsg = buf.array(); |
147 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 137 | + |
148 | - message.writeTo(buf); | 138 | + int iReadLen = buf.writerIndex() - 0; |
149 | - testInitiateCreationMsg = buf.array(); | 139 | + testInitiateCreationMsg = new byte[iReadLen]; |
150 | - | 140 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
151 | - int iReadLen = buf.writerIndex() - 0; | 141 | + |
152 | - testInitiateCreationMsg = new byte[iReadLen]; | 142 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
153 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 143 | + initiateCreationMsg, testInitiateCreationMsg); |
154 | - | ||
155 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
156 | - Assert.assertArrayEquals(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,34 +182,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -197,34 +182,28 @@ 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) { | 187 | + |
203 | - e.printStackTrace(); | 188 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
204 | - } | 189 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
205 | - | 190 | + message.writeTo(buf); |
206 | - if (message instanceof PcepInitiateMsg) { | 191 | + testInitiateCreationMsg = buf.array(); |
207 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 192 | + |
208 | - message.writeTo(buf); | 193 | + int iReadLen = buf.writerIndex() - 0; |
209 | - testInitiateCreationMsg = buf.array(); | 194 | + testInitiateCreationMsg = new byte[iReadLen]; |
210 | - | 195 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
211 | - int iReadLen = buf.writerIndex() - 0; | 196 | + |
212 | - testInitiateCreationMsg = new byte[iReadLen]; | 197 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
213 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
214 | - | ||
215 | - if (Arrays.equals(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,34 +235,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -256,34 +235,28 @@ 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) { | 240 | + |
262 | - e.printStackTrace(); | 241 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
263 | - } | 242 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
264 | - | 243 | + message.writeTo(buf); |
265 | - if (message instanceof PcepInitiateMsg) { | 244 | + testInitiateCreationMsg = buf.array(); |
266 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 245 | + |
267 | - message.writeTo(buf); | 246 | + int iReadLen = buf.writerIndex() - 0; |
268 | - testInitiateCreationMsg = buf.array(); | 247 | + testInitiateCreationMsg = new byte[iReadLen]; |
269 | - | 248 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
270 | - int iReadLen = buf.writerIndex() - 0; | 249 | + |
271 | - testInitiateCreationMsg = new byte[iReadLen]; | 250 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
272 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
273 | - | ||
274 | - if (Arrays.equals(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,34 +286,31 @@ public class PcepInitiateMsgTest2 { | ... | @@ -313,34 +286,31 @@ 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) { | 291 | + |
319 | - e.printStackTrace(); | 292 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", |
320 | - } | 293 | + (message instanceof PcepInitiateMsg)); |
321 | - | 294 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
322 | - if (message instanceof PcepInitiateMsg) { | 295 | + message.writeTo(buf); |
323 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 296 | + testInitiateCreationMsg = buf.array(); |
324 | - message.writeTo(buf); | 297 | + |
325 | - testInitiateCreationMsg = buf.array(); | 298 | + int iReadLen = buf.writerIndex() - 0; |
326 | - | 299 | + testInitiateCreationMsg = new byte[iReadLen]; |
327 | - int iReadLen = buf.writerIndex() - 0; | 300 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
328 | - testInitiateCreationMsg = new byte[iReadLen]; | 301 | + |
329 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 302 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
330 | - | 303 | + initiateCreationMsg, testInitiateCreationMsg); |
331 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | 304 | + |
332 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
333 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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,34 +341,29 @@ public class PcepInitiateMsgTest2 { | ... | @@ -371,34 +341,29 @@ 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) { | 346 | + |
377 | - e.printStackTrace(); | 347 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
378 | - } | 348 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
379 | - | 349 | + message.writeTo(buf); |
380 | - if (message instanceof PcepInitiateMsg) { | 350 | + testInitiateCreationMsg = buf.array(); |
381 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 351 | + |
382 | - message.writeTo(buf); | 352 | + int iReadLen = buf.writerIndex() - 0; |
383 | - testInitiateCreationMsg = buf.array(); | 353 | + testInitiateCreationMsg = new byte[iReadLen]; |
384 | - | 354 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
385 | - int iReadLen = buf.writerIndex() - 0; | 355 | + |
386 | - testInitiateCreationMsg = new byte[iReadLen]; | 356 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
387 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 357 | + |
388 | - | ||
389 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
390 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +395,29 @@ public class PcepInitiateMsgTest2 { | ... | @@ -430,34 +395,29 @@ 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) { | 400 | + |
436 | - e.printStackTrace(); | 401 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
437 | - } | 402 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
438 | - | 403 | + message.writeTo(buf); |
439 | - if (message instanceof PcepInitiateMsg) { | 404 | + testInitiateCreationMsg = buf.array(); |
440 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 405 | + |
441 | - message.writeTo(buf); | 406 | + int iReadLen = buf.writerIndex() - 0; |
442 | - testInitiateCreationMsg = buf.array(); | 407 | + testInitiateCreationMsg = new byte[iReadLen]; |
443 | - | 408 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
444 | - int iReadLen = buf.writerIndex() - 0; | 409 | + |
445 | - testInitiateCreationMsg = new byte[iReadLen]; | 410 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
446 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 411 | + |
447 | - | ||
448 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
449 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +448,30 @@ public class PcepInitiateMsgTest2 { | ... | @@ -488,34 +448,30 @@ 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) { | 453 | + |
494 | - e.printStackTrace(); | 454 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
495 | - } | 455 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
496 | - | 456 | + message.writeTo(buf); |
497 | - if (message instanceof PcepInitiateMsg) { | 457 | + testInitiateCreationMsg = buf.array(); |
498 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 458 | + |
499 | - message.writeTo(buf); | 459 | + int iReadLen = buf.writerIndex() - 0; |
500 | - testInitiateCreationMsg = buf.array(); | 460 | + testInitiateCreationMsg = new byte[iReadLen]; |
501 | - | 461 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
502 | - int iReadLen = buf.writerIndex() - 0; | 462 | + |
503 | - testInitiateCreationMsg = new byte[iReadLen]; | 463 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
504 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 464 | + initiateCreationMsg, testInitiateCreationMsg); |
505 | - | 465 | + |
506 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
507 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
508 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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,34 +501,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -545,34 +501,28 @@ 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) { | 506 | + |
551 | - e.printStackTrace(); | 507 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
552 | - } | 508 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
553 | - | 509 | + message.writeTo(buf); |
554 | - if (message instanceof PcepInitiateMsg) { | 510 | + testInitiateCreationMsg = buf.array(); |
555 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 511 | + |
556 | - message.writeTo(buf); | 512 | + int iReadLen = buf.writerIndex() - 0; |
557 | - testInitiateCreationMsg = buf.array(); | 513 | + testInitiateCreationMsg = new byte[iReadLen]; |
558 | - | 514 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
559 | - int iReadLen = buf.writerIndex() - 0; | 515 | + |
560 | - testInitiateCreationMsg = new byte[iReadLen]; | 516 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
561 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 517 | + |
562 | - | ||
563 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
564 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +549,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -599,34 +549,28 @@ 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) { | 554 | + |
605 | - e.printStackTrace(); | 555 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
606 | - } | 556 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
607 | - | 557 | + message.writeTo(buf); |
608 | - if (message instanceof PcepInitiateMsg) { | 558 | + testInitiateCreationMsg = buf.array(); |
609 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 559 | + |
610 | - message.writeTo(buf); | 560 | + int iReadLen = buf.writerIndex() - 0; |
611 | - testInitiateCreationMsg = buf.array(); | 561 | + testInitiateCreationMsg = new byte[iReadLen]; |
612 | - | 562 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
613 | - int iReadLen = buf.writerIndex() - 0; | 563 | + |
614 | - testInitiateCreationMsg = new byte[iReadLen]; | 564 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
615 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
616 | - | ||
617 | - if (Arrays.equals(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,33 +599,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -655,33 +599,28 @@ 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) { | 604 | + |
661 | - e.printStackTrace(); | 605 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
662 | - } | 606 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
663 | - | 607 | + message.writeTo(buf); |
664 | - if (message instanceof PcepInitiateMsg) { | 608 | + |
665 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 609 | + int iReadLen = buf.writerIndex() - 0; |
666 | - message.writeTo(buf); | 610 | + testInitiateCreationMsg = new byte[iReadLen]; |
667 | - | 611 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
668 | - int iReadLen = buf.writerIndex() - 0; | 612 | + |
669 | - testInitiateCreationMsg = new byte[iReadLen]; | 613 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
670 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 614 | + initiateCreationMsg, testInitiateCreationMsg); |
671 | - | ||
672 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
673 | - Assert.assertArrayEquals(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,34 +648,29 @@ public class PcepInitiateMsgTest2 { | ... | @@ -709,34 +648,29 @@ 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) { | 653 | + |
715 | - e.printStackTrace(); | 654 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
716 | - } | 655 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
717 | - | 656 | + message.writeTo(buf); |
718 | - if (message instanceof PcepInitiateMsg) { | 657 | + testInitiateCreationMsg = buf.array(); |
719 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 658 | + |
720 | - message.writeTo(buf); | 659 | + int iReadLen = buf.writerIndex() - 0; |
721 | - testInitiateCreationMsg = buf.array(); | 660 | + testInitiateCreationMsg = new byte[iReadLen]; |
722 | - | 661 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
723 | - int iReadLen = buf.writerIndex() - 0; | 662 | + |
724 | - testInitiateCreationMsg = new byte[iReadLen]; | 663 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
725 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 664 | + initiateCreationMsg, testInitiateCreationMsg); |
726 | - | ||
727 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
728 | - Assert.assertArrayEquals(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,34 +699,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -765,34 +699,28 @@ 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) { | 704 | + |
771 | - e.printStackTrace(); | 705 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
772 | - } | 706 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
773 | - | 707 | + message.writeTo(buf); |
774 | - if (message instanceof PcepInitiateMsg) { | 708 | + testInitiateCreationMsg = buf.array(); |
775 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 709 | + |
776 | - message.writeTo(buf); | 710 | + int iReadLen = buf.writerIndex() - 0; |
777 | - testInitiateCreationMsg = buf.array(); | 711 | + testInitiateCreationMsg = new byte[iReadLen]; |
778 | - | 712 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
779 | - int iReadLen = buf.writerIndex() - 0; | 713 | + |
780 | - testInitiateCreationMsg = new byte[iReadLen]; | 714 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
781 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 715 | + initiateCreationMsg, testInitiateCreationMsg); |
782 | - | ||
783 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
784 | - Assert.assertArrayEquals(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,34 +748,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -820,34 +748,28 @@ 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) { | 753 | + |
826 | - e.printStackTrace(); | 754 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
827 | - } | 755 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
828 | - | 756 | + message.writeTo(buf); |
829 | - if (message instanceof PcepInitiateMsg) { | 757 | + testInitiateCreationMsg = buf.array(); |
830 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 758 | + |
831 | - message.writeTo(buf); | 759 | + int iReadLen = buf.writerIndex() - 0; |
832 | - testInitiateCreationMsg = buf.array(); | 760 | + testInitiateCreationMsg = new byte[iReadLen]; |
833 | - | 761 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
834 | - int iReadLen = buf.writerIndex() - 0; | 762 | + |
835 | - testInitiateCreationMsg = new byte[iReadLen]; | 763 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
836 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 764 | + initiateCreationMsg, testInitiateCreationMsg); |
837 | - | ||
838 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
839 | - Assert.assertArrayEquals(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,34 +796,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -874,34 +796,28 @@ 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) { | 801 | + |
880 | - e.printStackTrace(); | 802 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
881 | - } | 803 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
882 | - | 804 | + message.writeTo(buf); |
883 | - if (message instanceof PcepInitiateMsg) { | 805 | + testInitiateCreationMsg = buf.array(); |
884 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 806 | + |
885 | - message.writeTo(buf); | 807 | + int iReadLen = buf.writerIndex() - 0; |
886 | - testInitiateCreationMsg = buf.array(); | 808 | + testInitiateCreationMsg = new byte[iReadLen]; |
887 | - | 809 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
888 | - int iReadLen = buf.writerIndex() - 0; | 810 | + |
889 | - testInitiateCreationMsg = new byte[iReadLen]; | 811 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
890 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 812 | + initiateCreationMsg, testInitiateCreationMsg); |
891 | - | ||
892 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
893 | - Assert.assertArrayEquals(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,34 +843,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -927,34 +843,28 @@ 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) { | 848 | + |
933 | - e.printStackTrace(); | 849 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
934 | - } | 850 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
935 | - | 851 | + message.writeTo(buf); |
936 | - if (message instanceof PcepInitiateMsg) { | 852 | + testInitiateCreationMsg = buf.array(); |
937 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 853 | + |
938 | - message.writeTo(buf); | 854 | + int iReadLen = buf.writerIndex() - 0; |
939 | - testInitiateCreationMsg = buf.array(); | 855 | + testInitiateCreationMsg = new byte[iReadLen]; |
940 | - | 856 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
941 | - int iReadLen = buf.writerIndex() - 0; | 857 | + |
942 | - testInitiateCreationMsg = new byte[iReadLen]; | 858 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
943 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 859 | + initiateCreationMsg, testInitiateCreationMsg); |
944 | - | ||
945 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
946 | - Assert.assertArrayEquals(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,34 +888,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -978,34 +888,28 @@ 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) { | 893 | + |
984 | - e.printStackTrace(); | 894 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
985 | - } | 895 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
986 | - | 896 | + message.writeTo(buf); |
987 | - if (message instanceof PcepInitiateMsg) { | 897 | + testInitiateCreationMsg = buf.array(); |
988 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 898 | + |
989 | - message.writeTo(buf); | 899 | + int iReadLen = buf.writerIndex() - 0; |
990 | - testInitiateCreationMsg = buf.array(); | 900 | + testInitiateCreationMsg = new byte[iReadLen]; |
991 | - | 901 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
992 | - int iReadLen = buf.writerIndex() - 0; | 902 | + |
993 | - testInitiateCreationMsg = new byte[iReadLen]; | 903 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
994 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 904 | + initiateCreationMsg, testInitiateCreationMsg); |
995 | - | ||
996 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
997 | - Assert.assertArrayEquals(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,34 +934,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1030,34 +934,28 @@ 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) { | 939 | + |
1036 | - e.printStackTrace(); | 940 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1037 | - } | 941 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1038 | - | 942 | + message.writeTo(buf); |
1039 | - if (message instanceof PcepInitiateMsg) { | 943 | + testInitiateCreationMsg = buf.array(); |
1040 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 944 | + |
1041 | - message.writeTo(buf); | 945 | + int iReadLen = buf.writerIndex() - 0; |
1042 | - testInitiateCreationMsg = buf.array(); | 946 | + testInitiateCreationMsg = new byte[iReadLen]; |
1043 | - | 947 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1044 | - int iReadLen = buf.writerIndex() - 0; | 948 | + |
1045 | - testInitiateCreationMsg = new byte[iReadLen]; | 949 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1046 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 950 | + initiateCreationMsg, testInitiateCreationMsg); |
1047 | - | ||
1048 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1049 | - Assert.assertArrayEquals(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,34 +981,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1083,34 +981,27 @@ 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) { | 986 | + |
1089 | - e.printStackTrace(); | 987 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1090 | - } | 988 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1091 | - | 989 | + message.writeTo(buf); |
1092 | - if (message instanceof PcepInitiateMsg) { | 990 | + testInitiateCreationMsg = buf.array(); |
1093 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 991 | + |
1094 | - message.writeTo(buf); | 992 | + int iReadLen = buf.writerIndex() - 0; |
1095 | - testInitiateCreationMsg = buf.array(); | 993 | + testInitiateCreationMsg = new byte[iReadLen]; |
1096 | - | 994 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1097 | - int iReadLen = buf.writerIndex() - 0; | 995 | + |
1098 | - testInitiateCreationMsg = new byte[iReadLen]; | 996 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1099 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1100 | - | ||
1101 | - if (Arrays.equals(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,34 +1026,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1135,34 +1026,28 @@ 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) { | 1031 | + |
1141 | - e.printStackTrace(); | 1032 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1142 | - } | 1033 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1143 | - | 1034 | + message.writeTo(buf); |
1144 | - if (message instanceof PcepInitiateMsg) { | 1035 | + testInitiateCreationMsg = buf.array(); |
1145 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1036 | + |
1146 | - message.writeTo(buf); | 1037 | + int iReadLen = buf.writerIndex() - 0; |
1147 | - testInitiateCreationMsg = buf.array(); | 1038 | + testInitiateCreationMsg = new byte[iReadLen]; |
1148 | - | 1039 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1149 | - int iReadLen = buf.writerIndex() - 0; | 1040 | + |
1150 | - testInitiateCreationMsg = new byte[iReadLen]; | 1041 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1151 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1042 | + initiateCreationMsg, testInitiateCreationMsg); |
1152 | - | ||
1153 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1154 | - Assert.assertArrayEquals(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,34 +1071,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1186,34 +1071,27 @@ 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) { | 1076 | + |
1192 | - e.printStackTrace(); | 1077 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1193 | - } | 1078 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1194 | - | 1079 | + message.writeTo(buf); |
1195 | - if (message instanceof PcepInitiateMsg) { | 1080 | + testInitiateCreationMsg = buf.array(); |
1196 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1081 | + |
1197 | - message.writeTo(buf); | 1082 | + int iReadLen = buf.writerIndex() - 0; |
1198 | - testInitiateCreationMsg = buf.array(); | 1083 | + testInitiateCreationMsg = new byte[iReadLen]; |
1199 | - | 1084 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1200 | - int iReadLen = buf.writerIndex() - 0; | 1085 | + |
1201 | - testInitiateCreationMsg = new byte[iReadLen]; | 1086 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1202 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1203 | - | ||
1204 | - if (Arrays.equals(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,34 +1114,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1236,34 +1114,28 @@ 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) { | 1119 | + |
1242 | - e.printStackTrace(); | 1120 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1243 | - } | 1121 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1244 | - | 1122 | + message.writeTo(buf); |
1245 | - if (message instanceof PcepInitiateMsg) { | 1123 | + testInitiateCreationMsg = buf.array(); |
1246 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1124 | + |
1247 | - message.writeTo(buf); | 1125 | + int iReadLen = buf.writerIndex() - 0; |
1248 | - testInitiateCreationMsg = buf.array(); | 1126 | + testInitiateCreationMsg = new byte[iReadLen]; |
1249 | - | 1127 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1250 | - int iReadLen = buf.writerIndex() - 0; | 1128 | + |
1251 | - testInitiateCreationMsg = new byte[iReadLen]; | 1129 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1252 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1130 | + initiateCreationMsg, testInitiateCreationMsg); |
1253 | - | ||
1254 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1255 | - Assert.assertArrayEquals(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,34 +1159,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1287,34 +1159,28 @@ 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) { | 1164 | + |
1293 | - e.printStackTrace(); | 1165 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1294 | - } | 1166 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1295 | - | 1167 | + message.writeTo(buf); |
1296 | - if (message instanceof PcepInitiateMsg) { | 1168 | + testInitiateCreationMsg = buf.array(); |
1297 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1169 | + |
1298 | - message.writeTo(buf); | 1170 | + int iReadLen = buf.writerIndex() - 0; |
1299 | - testInitiateCreationMsg = buf.array(); | 1171 | + testInitiateCreationMsg = new byte[iReadLen]; |
1300 | - | 1172 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1301 | - int iReadLen = buf.writerIndex() - 0; | 1173 | + |
1302 | - testInitiateCreationMsg = new byte[iReadLen]; | 1174 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1303 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1175 | + initiateCreationMsg, testInitiateCreationMsg); |
1304 | - | ||
1305 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1306 | - Assert.assertArrayEquals(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,34 +1205,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1339,34 +1205,28 @@ 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) { | 1210 | + |
1345 | - e.printStackTrace(); | 1211 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1346 | - } | 1212 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1347 | - | 1213 | + message.writeTo(buf); |
1348 | - if (message instanceof PcepInitiateMsg) { | 1214 | + testInitiateCreationMsg = buf.array(); |
1349 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1215 | + |
1350 | - message.writeTo(buf); | 1216 | + int iReadLen = buf.writerIndex() - 0; |
1351 | - testInitiateCreationMsg = buf.array(); | 1217 | + testInitiateCreationMsg = new byte[iReadLen]; |
1352 | - | 1218 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1353 | - int iReadLen = buf.writerIndex() - 0; | 1219 | + |
1354 | - testInitiateCreationMsg = new byte[iReadLen]; | 1220 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1355 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1221 | + initiateCreationMsg, testInitiateCreationMsg); |
1356 | - | ||
1357 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1358 | - Assert.assertArrayEquals(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,34 +1253,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1393,34 +1253,28 @@ 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) { | 1258 | + |
1399 | - e.printStackTrace(); | 1259 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1400 | - } | 1260 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1401 | - | 1261 | + message.writeTo(buf); |
1402 | - if (message instanceof PcepInitiateMsg) { | 1262 | + testInitiateCreationMsg = buf.array(); |
1403 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1263 | + |
1404 | - message.writeTo(buf); | 1264 | + int iReadLen = buf.writerIndex() - 0; |
1405 | - testInitiateCreationMsg = buf.array(); | 1265 | + testInitiateCreationMsg = new byte[iReadLen]; |
1406 | - | 1266 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1407 | - int iReadLen = buf.writerIndex() - 0; | 1267 | + |
1408 | - testInitiateCreationMsg = new byte[iReadLen]; | 1268 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1409 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1269 | + initiateCreationMsg, testInitiateCreationMsg); |
1410 | - | ||
1411 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1412 | - Assert.assertArrayEquals(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,34 +1298,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1444,34 +1298,27 @@ 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) { | 1303 | + |
1450 | - e.printStackTrace(); | 1304 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1451 | - } | 1305 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1452 | - | 1306 | + message.writeTo(buf); |
1453 | - if (message instanceof PcepInitiateMsg) { | 1307 | + testInitiateCreationMsg = buf.array(); |
1454 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1308 | + |
1455 | - message.writeTo(buf); | 1309 | + int iReadLen = buf.writerIndex() - 0; |
1456 | - testInitiateCreationMsg = buf.array(); | 1310 | + testInitiateCreationMsg = new byte[iReadLen]; |
1457 | - | 1311 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1458 | - int iReadLen = buf.writerIndex() - 0; | 1312 | + |
1459 | - testInitiateCreationMsg = new byte[iReadLen]; | 1313 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1460 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1461 | - | ||
1462 | - if (Arrays.equals(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,34 +1341,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1494,34 +1341,28 @@ 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) { | 1346 | + |
1500 | - e.printStackTrace(); | 1347 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1501 | - } | 1348 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1502 | - | 1349 | + message.writeTo(buf); |
1503 | - if (message instanceof PcepInitiateMsg) { | 1350 | + testInitiateCreationMsg = buf.array(); |
1504 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1351 | + |
1505 | - message.writeTo(buf); | 1352 | + int iReadLen = buf.writerIndex() - 0; |
1506 | - testInitiateCreationMsg = buf.array(); | 1353 | + testInitiateCreationMsg = new byte[iReadLen]; |
1507 | - | 1354 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1508 | - int iReadLen = buf.writerIndex() - 0; | 1355 | + |
1509 | - testInitiateCreationMsg = new byte[iReadLen]; | 1356 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1510 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1357 | + initiateCreationMsg, testInitiateCreationMsg); |
1511 | - | ||
1512 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1513 | - Assert.assertArrayEquals(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,34 +1384,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1543,34 +1384,27 @@ 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) { | 1389 | + |
1549 | - e.printStackTrace(); | 1390 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1550 | - } | 1391 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1551 | - | 1392 | + message.writeTo(buf); |
1552 | - if (message instanceof PcepInitiateMsg) { | 1393 | + testInitiateCreationMsg = buf.array(); |
1553 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1394 | + |
1554 | - message.writeTo(buf); | 1395 | + int iReadLen = buf.writerIndex() - 0; |
1555 | - testInitiateCreationMsg = buf.array(); | 1396 | + testInitiateCreationMsg = new byte[iReadLen]; |
1556 | - | 1397 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1557 | - int iReadLen = buf.writerIndex() - 0; | 1398 | + |
1558 | - testInitiateCreationMsg = new byte[iReadLen]; | 1399 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1559 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1560 | - | ||
1561 | - if (Arrays.equals(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,34 +1427,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1593,34 +1427,27 @@ 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) { | 1432 | + |
1599 | - e.printStackTrace(); | 1433 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1600 | - } | 1434 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1601 | - | 1435 | + message.writeTo(buf); |
1602 | - if (message instanceof PcepInitiateMsg) { | 1436 | + testInitiateCreationMsg = buf.array(); |
1603 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1437 | + |
1604 | - message.writeTo(buf); | 1438 | + int iReadLen = buf.writerIndex() - 0; |
1605 | - testInitiateCreationMsg = buf.array(); | 1439 | + testInitiateCreationMsg = new byte[iReadLen]; |
1606 | - | 1440 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1607 | - int iReadLen = buf.writerIndex() - 0; | 1441 | + |
1608 | - testInitiateCreationMsg = new byte[iReadLen]; | 1442 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1609 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1610 | - | ||
1611 | - if (Arrays.equals(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,34 +1469,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1642,34 +1469,27 @@ 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) { | 1474 | + |
1648 | - e.printStackTrace(); | 1475 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1649 | - } | 1476 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1650 | - | 1477 | + message.writeTo(buf); |
1651 | - if (message instanceof PcepInitiateMsg) { | 1478 | + testInitiateCreationMsg = buf.array(); |
1652 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1479 | + |
1653 | - message.writeTo(buf); | 1480 | + int iReadLen = buf.writerIndex() - 0; |
1654 | - testInitiateCreationMsg = buf.array(); | 1481 | + testInitiateCreationMsg = new byte[iReadLen]; |
1655 | - | 1482 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1656 | - int iReadLen = buf.writerIndex() - 0; | 1483 | + |
1657 | - testInitiateCreationMsg = new byte[iReadLen]; | 1484 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1658 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1659 | - | ||
1660 | - if (Arrays.equals(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,34 +1515,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1695,34 +1515,28 @@ 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) { | 1520 | + |
1701 | - e.printStackTrace(); | 1521 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1702 | - } | 1522 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1703 | - | 1523 | + message.writeTo(buf); |
1704 | - if (message instanceof PcepInitiateMsg) { | 1524 | + testInitiateCreationMsg = buf.array(); |
1705 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1525 | + |
1706 | - message.writeTo(buf); | 1526 | + int iReadLen = buf.writerIndex() - 0; |
1707 | - testInitiateCreationMsg = buf.array(); | 1527 | + testInitiateCreationMsg = new byte[iReadLen]; |
1708 | - | 1528 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1709 | - int iReadLen = buf.writerIndex() - 0; | 1529 | + |
1710 | - testInitiateCreationMsg = new byte[iReadLen]; | 1530 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1711 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1531 | + |
1712 | - | ||
1713 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1714 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
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,34 +1561,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1747,34 +1561,28 @@ 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) { | 1566 | + |
1753 | - e.printStackTrace(); | 1567 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1754 | - } | 1568 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1755 | - | 1569 | + message.writeTo(buf); |
1756 | - if (message instanceof PcepInitiateMsg) { | 1570 | + testInitiateCreationMsg = buf.array(); |
1757 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1571 | + |
1758 | - message.writeTo(buf); | 1572 | + int iReadLen = buf.writerIndex() - 0; |
1759 | - testInitiateCreationMsg = buf.array(); | 1573 | + testInitiateCreationMsg = new byte[iReadLen]; |
1760 | - | 1574 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1761 | - int iReadLen = buf.writerIndex() - 0; | 1575 | + |
1762 | - testInitiateCreationMsg = new byte[iReadLen]; | 1576 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1763 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1577 | + initiateCreationMsg, testInitiateCreationMsg); |
1764 | - | ||
1765 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1766 | - Assert.assertArrayEquals(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,34 +1606,27 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1798,34 +1606,27 @@ 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) { | 1611 | + |
1804 | - e.printStackTrace(); | 1612 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1805 | - } | 1613 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1806 | - | 1614 | + message.writeTo(buf); |
1807 | - if (message instanceof PcepInitiateMsg) { | 1615 | + testInitiateCreationMsg = buf.array(); |
1808 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1616 | + |
1809 | - message.writeTo(buf); | 1617 | + int iReadLen = buf.writerIndex() - 0; |
1810 | - testInitiateCreationMsg = buf.array(); | 1618 | + testInitiateCreationMsg = new byte[iReadLen]; |
1811 | - | 1619 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1812 | - int iReadLen = buf.writerIndex() - 0; | 1620 | + |
1813 | - testInitiateCreationMsg = new byte[iReadLen]; | 1621 | + Assert.assertArrayEquals("PcInitiate messages are not equal", initiateCreationMsg, testInitiateCreationMsg); |
1814 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | ||
1815 | - | ||
1816 | - if (Arrays.equals(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,34 +1651,28 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1850,34 +1651,28 @@ 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) { | 1656 | + |
1856 | - e.printStackTrace(); | 1657 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1857 | - } | 1658 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1858 | - | 1659 | + message.writeTo(buf); |
1859 | - if (message instanceof PcepInitiateMsg) { | 1660 | + testInitiateCreationMsg = buf.array(); |
1860 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1661 | + |
1861 | - message.writeTo(buf); | 1662 | + int iReadLen = buf.writerIndex() - 0; |
1862 | - testInitiateCreationMsg = buf.array(); | 1663 | + testInitiateCreationMsg = new byte[iReadLen]; |
1863 | - | 1664 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1864 | - int iReadLen = buf.writerIndex() - 0; | 1665 | + |
1865 | - testInitiateCreationMsg = new byte[iReadLen]; | 1666 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1866 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1667 | + initiateCreationMsg, testInitiateCreationMsg); |
1867 | - | ||
1868 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1869 | - Assert.assertArrayEquals(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,32 +1696,21 @@ public class PcepInitiateMsgTest2 { | ... | @@ -1901,32 +1696,21 @@ 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) { | 1701 | + |
1907 | - e.printStackTrace(); | 1702 | + Assert.assertTrue("PcepMessage is not instance of PcInitiate", (message instanceof PcepInitiateMsg)); |
1908 | - } | 1703 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
1909 | - | 1704 | + message.writeTo(buf); |
1910 | - if (message instanceof PcepInitiateMsg) { | 1705 | + testInitiateCreationMsg = buf.array(); |
1911 | - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 1706 | + |
1912 | - message.writeTo(buf); | 1707 | + int iReadLen = buf.writerIndex() - 0; |
1913 | - testInitiateCreationMsg = buf.array(); | 1708 | + testInitiateCreationMsg = new byte[iReadLen]; |
1914 | - | 1709 | + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); |
1915 | - int iReadLen = buf.writerIndex() - 0; | 1710 | + |
1916 | - testInitiateCreationMsg = new byte[iReadLen]; | 1711 | + Assert.assertArrayEquals("PcInitiate messages are not equal", |
1917 | - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); | 1712 | + initiateCreationMsg, testInitiateCreationMsg); |
1918 | - | 1713 | + |
1919 | - if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) { | ||
1920 | - Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg); | ||
1921 | - log.debug("PCInitiate Msg are equal :" + initiateCreationMsg); | ||
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