2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.pcep.impl;
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
14 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
15 import org.opendaylight.protocol.pcep.impl.subobject.GeneralizedLabelParser;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.GeneralizedLabelBuilder;
18 public class LabelSubobjectParserTest {
20 private final byte[] generalizedLabelBytes = { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF };
23 public void testGeneralizedLabel() throws PCEPDeserializerException {
24 final GeneralizedLabelParser parser = new GeneralizedLabelParser();
25 final GeneralizedLabelBuilder builder = new GeneralizedLabelBuilder();
26 builder.setGeneralizedLabel(this.generalizedLabelBytes);
27 assertEquals(builder.build(), parser.parseLabel(this.generalizedLabelBytes));
28 assertArrayEquals(this.generalizedLabelBytes, parser.serializeLabel(builder.build()));