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