Remove private constructor tests
[bgpcep.git] / rsvp / impl / src / test / java / org / opendaylight / protocol / rsvp / parser / impl / te / TEObjectTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.protocol.rsvp.parser.impl.te;
10
11 import static org.junit.Assert.assertArrayEquals;
12
13 import io.netty.buffer.ByteBuf;
14 import io.netty.buffer.Unpooled;
15 import org.junit.Assert;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator;
19 import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser;
20 import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SERODynamicProtectionSubobjectParser;
21 import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser;
22 import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser;
23 import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
24 import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
25 import org.opendaylight.protocol.util.ByteArray;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder;
30
31 public class TEObjectTest {
32     private RSVPActivator act;
33     private SimpleRSVPExtensionProviderContext context;
34
35     @Before
36     public void setUp() {
37         this.act = new RSVPActivator();
38         this.context = new SimpleRSVPExtensionProviderContext();
39         this.act.start(this.context);
40     }
41
42     @Test
43     public void testAdminStatusObjectParser() throws RSVPParsingException {
44         final AdminStatusObjectParser admParser = new AdminStatusObjectParser();
45         final RsvpTeObject obj = admParser.parseObject(Unpooled.copiedBuffer(
46             ByteArray.subByte(TEObjectUtil.TE_LSP_ADMIN_STATUS, 4,
47                 TEObjectUtil.TE_LSP_ADMIN_STATUS.length - 4)));
48         final ByteBuf output = Unpooled.buffer();
49         admParser.serializeObject(obj, output);
50         assertArrayEquals(TEObjectUtil.TE_LSP_ADMIN_STATUS, ByteArray.getAllBytes(output));
51     }
52
53     @Test
54     public void testAssociationObjectParser1() throws RSVPParsingException {
55         final AssociationObjectParserIPV4 parser = new AssociationObjectParserIPV4();
56         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
57             ByteArray.subByte(TEObjectUtil.TE_LSP_ASSOCIATION_1, 4,
58                 TEObjectUtil.TE_LSP_ASSOCIATION_1.length - 4)));
59
60         final ByteBuf output = Unpooled.buffer();
61         parser.serializeObject(obj, output);
62         assertArrayEquals(TEObjectUtil.TE_LSP_ASSOCIATION_1, ByteArray.getAllBytes(output));
63     }
64
65     @Test
66     public void testAssociationObjectParser2() throws RSVPParsingException {
67         final AssociationObjectParserIPV6 parser = new AssociationObjectParserIPV6();
68         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
69             ByteArray.subByte(TEObjectUtil.TE_LSP_ASSOCIATION_2, 4, TEObjectUtil.TE_LSP_ASSOCIATION_2.length - 4)));
70
71         final ByteBuf output = Unpooled.buffer();
72         parser.serializeObject(obj, output);
73         assertArrayEquals(TEObjectUtil.TE_LSP_ASSOCIATION_2, ByteArray.getAllBytes(output));
74     }
75
76     @Test
77     public void testBandwidthObjectParser1() throws RSVPParsingException {
78         final BandwidthObjectParser parser = new BandwidthObjectParser();
79         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
80             ByteArray.subByte(TEObjectUtil.TE_LSP_BANDWIDTH_1, 4, TEObjectUtil.TE_LSP_BANDWIDTH_1
81                 .length - 4)));
82
83         final ByteBuf output = Unpooled.buffer();
84         parser.serializeObject(obj, output);
85         assertArrayEquals(TEObjectUtil.TE_LSP_BANDWIDTH_1, ByteArray.getAllBytes(output));
86     }
87
88     @Test
89     public void testBandwidthObjectParser2() throws RSVPParsingException {
90         final ReoptimizationBandwidthObjectParser parser = new ReoptimizationBandwidthObjectParser();
91         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
92             ByteArray.subByte(TEObjectUtil.TE_LSP_BANDWIDTH_2, 4, TEObjectUtil.TE_LSP_BANDWIDTH_2
93                 .length - 4)));
94
95         final ByteBuf output = Unpooled.buffer();
96         parser.serializeObject(obj, output);
97         assertArrayEquals(TEObjectUtil.TE_LSP_BANDWIDTH_2, ByteArray.getAllBytes(output));
98     }
99
100     @Test
101     public void testExcludeRouteParser() throws RSVPParsingException {
102         final ExcludeRouteObjectParser parser = new ExcludeRouteObjectParser(
103             this.context.getXROSubobjectHandlerRegistry());
104         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
105             ByteArray.subByte(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, 4,
106                 TEObjectUtil.TE_LSP_EXCLUDE_ROUTE.length - 4)));
107
108         final ByteBuf output = Unpooled.buffer();
109         parser.serializeObject(obj, output);
110         assertArrayEquals(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, ByteArray.getAllBytes(output));
111     }
112
113     @Test
114     public void testExplicitRouteParser() throws RSVPParsingException {
115         final ExplicitRouteObjectParser parser = new ExplicitRouteObjectParser(
116             this.context.getEROSubobjectHandlerRegistry());
117         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(ByteArray.subByte(
118             TEObjectUtil.TE_LSP_EXPLICIT, 4, TEObjectUtil.TE_LSP_EXPLICIT.length - 4)));
119
120         final ByteBuf output = Unpooled.buffer();
121         parser.serializeObject(obj, output);
122         assertArrayEquals(TEObjectUtil.TE_LSP_EXPLICIT, ByteArray.getAllBytes(output));
123     }
124
125     @Test
126     public void testAttributesObject12Parser() throws RSVPParsingException {
127         final AttributesObjectParser parser = new AttributesObjectParser();
128         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
129             ByteArray.subByte(TEObjectUtil.TE_LSP_ATTRIBUTES, 4,
130                 TEObjectUtil.TE_LSP_ATTRIBUTES.length - 4)));
131
132         final ByteBuf output = Unpooled.buffer();
133         parser.serializeObject(obj, output);
134         assertArrayEquals(TEObjectUtil.TE_LSP_ATTRIBUTES, ByteArray.getAllBytes(output));
135     }
136
137     @Test
138     public void testRequiredAttributesParser() throws RSVPParsingException {
139         final RequiredAttributesObjectParser parser = new RequiredAttributesObjectParser();
140         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
141             ByteArray.subByte(TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES, 4,
142                 TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES.length - 4)));
143
144         final ByteBuf output = Unpooled.buffer();
145         parser.serializeObject(obj, output);
146         assertArrayEquals(TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES, ByteArray.getAllBytes(output));
147     }
148
149     @Test
150     public void testPrimaryPathRouteParser() throws RSVPParsingException {
151         final PrimaryPathRouteObjectParser parser = new PrimaryPathRouteObjectParser(
152             this.context.getEROSubobjectHandlerRegistry());
153         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
154             ByteArray.subByte(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, 4,
155                 TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE.length - 4)));
156
157         final ByteBuf output = Unpooled.buffer();
158         parser.serializeObject(obj, output);
159         assertArrayEquals(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, ByteArray.getAllBytes(output));
160     }
161
162
163     @Test
164     public void testProtectionObjectParser1() throws RSVPParsingException {
165         final ProtectionObjectParser parser = new ProtectionObjectParser();
166         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
167             ByteArray.subByte(TEObjectUtil.TE_LSP_PROTECTION_C1, 4,
168                 TEObjectUtil.TE_LSP_PROTECTION_C1.length - 4)));
169         final ByteBuf output = Unpooled.buffer();
170         parser.serializeObject(obj, output);
171         assertArrayEquals(TEObjectUtil.TE_LSP_PROTECTION_C1, ByteArray.getAllBytes(output));
172     }
173
174     @Test
175     public void testProtectionObjectParser2() throws RSVPParsingException {
176         final DynamicProtectionObjectParser parser = new DynamicProtectionObjectParser();
177         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
178             ByteArray.subByte(TEObjectUtil.TE_LSP_PROTECTION_C2, 4,
179                 TEObjectUtil.TE_LSP_PROTECTION_C2.length - 4)));
180         final ByteBuf output = Unpooled.buffer();
181         parser.serializeObject(obj, output);
182         assertArrayEquals(TEObjectUtil.TE_LSP_PROTECTION_C2, ByteArray.getAllBytes(output));
183     }
184
185     @Test
186     public void testProtectionCommonParser() {
187         final ByteBuf emptyBuff = Unpooled.buffer();
188         try {
189             ProtectionCommonParser.parseCommonProtectionBodyType2(emptyBuff);
190             Assert.fail();
191         } catch (final RSVPParsingException e) {
192             Assert.assertEquals("Wrong length of array of bytes. Passed: " + emptyBuff.readableBytes()
193                 + "; Expected: " + ProtectionCommonParser.CONTENT_LENGTH_C2 + ".", e.getMessage());
194         }
195     }
196
197     @Test
198     public void testRecordRouteParser() throws RSVPParsingException {
199         final RecordRouteObjectParser parser = new RecordRouteObjectParser(
200             this.context.getRROSubobjectHandlerRegistry());
201         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
202             ByteArray.subByte(TEObjectUtil.TE_LSP_RECORD_ROUTE, 4,
203                 TEObjectUtil.TE_LSP_RECORD_ROUTE.length - 4)));
204
205         final ByteBuf output = Unpooled.buffer();
206         parser.serializeObject(obj, output);
207         assertArrayEquals(TEObjectUtil.TE_LSP_RECORD_ROUTE, ByteArray.getAllBytes(output));
208     }
209
210     @Test
211     public void testSecondaryExplicitRouteParser() throws RSVPParsingException {
212         final SecondaryExplicitRouteObjectParser parser = new SecondaryExplicitRouteObjectParser(
213             this.context.getEROSubobjectHandlerRegistry());
214         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
215             ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, 4,
216                 TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT.length - 4)));
217
218         final ByteBuf output = Unpooled.buffer();
219         parser.serializeObject(obj, output);
220         assertArrayEquals(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, ByteArray.getAllBytes(output));
221     }
222
223     @Test
224     public void testSecondaryRecordRouteObjectParser() throws RSVPParsingException {
225         final SecondaryRecordRouteObjectParser parser = new SecondaryRecordRouteObjectParser(
226             this.context.getRROSubobjectHandlerRegistry());
227         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
228             ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, 4,
229                 TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE.length - 4)));
230
231         final ByteBuf output = Unpooled.buffer();
232         parser.serializeObject(obj, output);
233         assertArrayEquals(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, ByteArray.getAllBytes(output));
234     }
235
236     @Test
237     public void testSSRODynamicProtectionSubobjectParser() throws RSVPParsingException {
238         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
239         final SRRODynamicProtectionSubobjectParser dynamicParser = new SRRODynamicProtectionSubobjectParser();
240         final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
241             ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, 2,
242                 TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION.length - 2)));
243
244         final ByteBuf output = Unpooled.buffer();
245         dynamicParser.serializeSubobject(sub, output);
246         assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
247     }
248
249     @Test
250     public void testSSROBasicProtectionSubobjectParser() throws RSVPParsingException {
251         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
252         final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
253             ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, 2,
254                 TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION.length - 2)));
255
256         final ByteBuf output = Unpooled.buffer();
257         parser.serializeSubobject(sub, output);
258         assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
259     }
260
261     @Test(expected = IllegalArgumentException.class)
262     public void testWrongParseSRRO() throws RSVPParsingException {
263         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
264         parser.parseSubobject(null);
265     }
266
267     @Test(expected = IllegalArgumentException.class)
268     public void testWrongSerializeSRRO() throws RSVPParsingException {
269         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route
270             .object.secondary.record.route.object.subobject.container.subobject.type
271             .DynamicControlProtectionCase dynamicProtection = new org.opendaylight.yang.gen.v1.urn
272             .opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route
273             .object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder().build();
274         final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
275         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects
276             .list.SubobjectContainer subContainer = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
277             .rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder().setSubobjectType(dynamicProtection)
278             .build();
279         parser.serializeSubobject(subContainer, Unpooled.buffer());
280     }
281
282     @Test
283     public void testSERODynamicProtectionSubobjectParser() throws RSVPParsingException {
284         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
285         final SERODynamicProtectionSubobjectParser dynamicParser = new SERODynamicProtectionSubobjectParser();
286         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects
287             .list.SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
288             ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, 2,
289                 TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION.length - 2)), true);
290
291         final ByteBuf output = Unpooled.buffer();
292         dynamicParser.serializeSubobject(sub, output);
293         assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
294     }
295
296     @Test(expected = IllegalArgumentException.class)
297     public void testWrongParseSERO() throws RSVPParsingException {
298         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
299         parser.parseSubobject(null, false);
300     }
301
302     @Test(expected = IllegalArgumentException.class)
303     public void testWrongSerializeSERO() throws RSVPParsingException {
304         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
305         parser.serializeSubobject(new SubobjectContainerBuilder().setSubobjectType(
306             new DynamicControlProtectionCaseBuilder().build()).build(), Unpooled.buffer());
307     }
308
309     @Test
310     public void testSEROBasicProtectionSubobjectParser() throws RSVPParsingException {
311         final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
312         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects
313             .list.SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
314             ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, 2,
315                 TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION.length - 2)), true);
316
317         final ByteBuf output = Unpooled.buffer();
318         parser.serializeSubobject(sub, output);
319         assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
320     }
321
322     @Test
323     public void testDetourObjectParser7() throws RSVPParsingException {
324         final DetourObjectIpv4Parser parser = new DetourObjectIpv4Parser();
325         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
326             ByteArray.subByte(TEObjectUtil.TE_LSP_DETOUR7, 4, TEObjectUtil.TE_LSP_DETOUR7.length - 4)));
327
328         final ByteBuf output = Unpooled.buffer();
329         parser.serializeObject(obj, output);
330         assertArrayEquals(TEObjectUtil.TE_LSP_DETOUR7, ByteArray.getAllBytes(output));
331     }
332
333     @Test
334     public void testDetourObjectParser8() throws RSVPParsingException {
335         final DetourObjectIpv6Parser parser = new DetourObjectIpv6Parser();
336         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
337             ByteArray.subByte(TEObjectUtil.TE_LSP_DETOUR8, 4, TEObjectUtil.TE_LSP_DETOUR8.length - 4)));
338
339         final ByteBuf output = Unpooled.buffer();
340         parser.serializeObject(obj, output);
341         assertArrayEquals(TEObjectUtil.TE_LSP_DETOUR8, ByteArray.getAllBytes(output));
342     }
343
344     @Test
345     public void testFastRerouteObjectParser1() throws RSVPParsingException {
346         final FastRerouteObjectParser parser = new FastRerouteObjectParser();
347         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
348             ByteArray.subByte(TEObjectUtil.TE_LSP_FAST_REROUTE1, 4,
349                 TEObjectUtil.TE_LSP_FAST_REROUTE1.length - 4)));
350
351         final ByteBuf output = Unpooled.buffer();
352         parser.serializeObject(obj, output);
353         assertArrayEquals(TEObjectUtil.TE_LSP_FAST_REROUTE1, ByteArray.getAllBytes(output));
354     }
355
356     @Test
357     public void testFastRerouteObjectParser7() throws RSVPParsingException {
358         final InformationalFastRerouteObjectParser parser = new InformationalFastRerouteObjectParser();
359         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
360             ByteArray.subByte(TEObjectUtil.TE_LSP_FAST_REROUTE7, 4,
361                 TEObjectUtil.TE_LSP_FAST_REROUTE7.length - 4)));
362
363         final ByteBuf output = Unpooled.buffer();
364         parser.serializeObject(obj, output);
365         assertArrayEquals(TEObjectUtil.TE_LSP_FAST_REROUTE7, ByteArray.getAllBytes(output));
366     }
367
368     @Test
369     public void testFlowSpecObjectParser_HEAD_5() throws RSVPParsingException {
370         final FlowSpecObjectParser parser = new FlowSpecObjectParser();
371         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
372             ByteArray.subByte(TEObjectUtil.TE_LSP_FLOWSPEC_H5, 4,
373                 TEObjectUtil.TE_LSP_FLOWSPEC_H5.length - 4)));
374
375         final ByteBuf output = Unpooled.buffer();
376         parser.serializeObject(obj, output);
377         assertArrayEquals(TEObjectUtil.TE_LSP_FLOWSPEC_H5, ByteArray.getAllBytes(output));
378     }
379
380     @Test
381     public void testFlowSpecObjectParser_HEAD_2() throws RSVPParsingException {
382         final FlowSpecObjectParser parser = new FlowSpecObjectParser();
383         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
384             ByteArray.subByte(TEObjectUtil.TE_LSP_FLOWSPEC_H2, 4,
385                 TEObjectUtil.TE_LSP_FLOWSPEC_H2.length - 4)));
386
387         final ByteBuf output = Unpooled.buffer();
388         parser.serializeObject(obj, output);
389         assertArrayEquals(TEObjectUtil.TE_LSP_FLOWSPEC_H2, ByteArray.getAllBytes(output));
390     }
391
392     @Test
393     public void testParser_HEAD_5() throws RSVPParsingException {
394         final SenderTspecObjectParser parser = new SenderTspecObjectParser();
395         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
396             ByteArray.subByte(TEObjectUtil.TE_LSP_SENDER_TSPEC, 4,
397                 TEObjectUtil.TE_LSP_SENDER_TSPEC.length - 4)));
398
399         final ByteBuf output = Unpooled.buffer();
400         parser.serializeObject(obj, output);
401         assertArrayEquals(TEObjectUtil.TE_LSP_SENDER_TSPEC, ByteArray.getAllBytes(output));
402     }
403
404     @Test
405     public void testSessionAttributeParser1() throws RSVPParsingException {
406         final SessionAttributeLspRaObjectParser parser = new SessionAttributeLspRaObjectParser();
407         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
408             ByteArray.subByte(TEObjectUtil.TE_LSP_SESSION_C1, 4,
409                 TEObjectUtil.TE_LSP_SESSION_C1.length - 4)));
410
411         final ByteBuf output = Unpooled.buffer();
412         parser.serializeObject(obj, output);
413         assertArrayEquals(TEObjectUtil.TE_LSP_SESSION_C1, ByteArray.getAllBytes(output));
414     }
415
416     @Test
417     public void testSessionAttributeParser7() throws RSVPParsingException {
418         final SessionAttributeLspObjectParser parser = new SessionAttributeLspObjectParser();
419         final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
420             ByteArray.subByte(TEObjectUtil.TE_LSP_SESSION_C7, 4,
421                 TEObjectUtil.TE_LSP_SESSION_C7.length - 4)));
422
423         final ByteBuf output = Unpooled.buffer();
424         parser.serializeObject(obj, output);
425         assertArrayEquals(TEObjectUtil.TE_LSP_SESSION_C7, ByteArray.getAllBytes(output));
426     }
427 }