2 * Copyright (c) 2014 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowjava.util;
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey;
14 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeSerializerKey;
15 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
21 * Test ExperimenterSerializerKeyFactory key creation
22 * @author michal.polkorab
25 public class ExperimenterSerializerKeyFactoryTest {
28 public void testCreateExperimenterMessageSerializerKey() throws Exception {
29 ExperimenterIdSerializerKey<?> createdKey;
30 ExperimenterIdSerializerKey<?> comparationKey;
32 createdKey = ExperimenterSerializerKeyFactory
33 .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L);
34 comparationKey = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
35 42L, 1L, ExperimenterDataOfChoice.class);
36 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
40 public void testCreateMultipartRequestSerializerKey() throws Exception {
41 ExperimenterIdSerializerKey<?> createdKey;
42 ExperimenterIdSerializerKey<?> comparationKey;
44 createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
45 EncodeConstants.OF10_VERSION_ID, 44L, 1L);
46 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
47 44L, ExperimenterDataOfChoice.class);
48 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
52 public void testCreateMultipartRequestTFSerializerKey() throws Exception {
53 ExperimenterIdSerializerKey<?> createdKey;
54 ExperimenterIdSerializerKey<?> comparationKey;
56 createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
57 EncodeConstants.OF10_VERSION_ID, 45L);
58 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
59 45L, TableFeatureProperties.class);
60 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
64 public void testCreateMeterBandSerializerKey() throws Exception {
65 ExperimenterIdSerializerKey<?> createdKey;
66 ExperimenterIdSerializerKey<?> comparationKey;
68 createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
69 EncodeConstants.OF10_VERSION_ID, 43L);
70 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
71 43L, MeterBandExperimenterCase.class);
72 Assert.assertEquals("Wrong key created", comparationKey, createdKey);