2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.openflowjava.util;
\r
11 import org.junit.Assert;
\r
12 import org.junit.Test;
\r
13 import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
\r
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
\r
21 * @author michal.polkorab
\r
24 public class ExperimenterSerializerKeyFactoryTest {
\r
27 * Test ExperimenterSerializerKeyFactory key creation
\r
30 public void test() {
\r
31 ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory
\r
32 .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
\r
33 ExperimenterIdSerializerKey<?> comparationKey =
\r
34 new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);
\r
35 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
36 createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(
\r
37 EncodeConstants.OF10_VERSION_ID, null);
\r
38 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
39 null, ExperimenterInput.class);
\r
40 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
41 createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
\r
42 EncodeConstants.OF10_VERSION_ID, 43L);
\r
43 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
44 43L, MeterBandExperimenterCase.class);
\r
45 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
46 createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
\r
47 EncodeConstants.OF10_VERSION_ID, null);
\r
48 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
49 null, MeterBandExperimenterCase.class);
\r
50 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
51 createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
\r
52 EncodeConstants.OF10_VERSION_ID, 44L);
\r
53 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
54 44L, MultipartRequestExperimenterCase.class);
\r
55 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
56 createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
\r
57 EncodeConstants.OF10_VERSION_ID, null);
\r
58 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
59 null, MultipartRequestExperimenterCase.class);
\r
60 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
61 createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
\r
62 EncodeConstants.OF10_VERSION_ID, 45L);
\r
63 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
64 45L, TableFeatureProperties.class);
\r
65 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r
66 createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
\r
67 EncodeConstants.OF10_VERSION_ID, null);
\r
68 comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
\r
69 null, TableFeatureProperties.class);
\r
70 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
\r