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.ExperimenterIdDeserializerKey;
14 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeDeserializerKey;
15 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
23 * Unit tests for ExperimenterDeserializerKeyFactory.
25 * @author michal.polkorab
27 public class ExperimenterDeserializerKeyFactoryTest {
30 public void testCreateExperimenterErrorDeserializerKey() throws Exception {
31 ExperimenterIdDeserializerKey createdKey;
32 ExperimenterIdDeserializerKey comparationKey;
34 createdKey = ExperimenterDeserializerKeyFactory
35 .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
36 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
37 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
41 public void testCreateExperimenterMessageDeserializerKey() throws Exception {
42 ExperimenterIdDeserializerKey createdKey;
43 ExperimenterIdDeserializerKey comparationKey;
45 createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
46 EncodeConstants.OF10_VERSION_ID, 43L, 1L);
47 comparationKey = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
48 43L, 1L, ExperimenterDataOfChoice.class);
49 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
53 public void testCreateMultipartReplyMessageDeserializerKey() throws Exception {
54 ExperimenterIdDeserializerKey createdKey;
55 ExperimenterIdDeserializerKey comparationKey;
57 createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
58 EncodeConstants.OF10_VERSION_ID, 45L, 1L);
59 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
60 45L, ExperimenterDataOfChoice.class);
61 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
65 public void testCreateMultipartReplyTFDeserializerKey() throws Exception {
66 ExperimenterIdDeserializerKey createdKey;
67 ExperimenterIdDeserializerKey comparationKey;
69 createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
70 EncodeConstants.OF10_VERSION_ID, 46L);
71 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
72 46L, TableFeatureProperties.class);
73 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
77 public void testCreateQueuePropertyDeserializerKey() throws Exception {
78 ExperimenterIdDeserializerKey createdKey;
79 ExperimenterIdDeserializerKey comparationKey;
81 createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
82 EncodeConstants.OF10_VERSION_ID, 47L);
83 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
84 47L, QueueProperty.class);
85 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
89 public void testCreateMeterBandDeserializerKey() throws Exception {
90 ExperimenterIdDeserializerKey createdKey;
91 ExperimenterIdDeserializerKey comparationKey;
93 createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
94 EncodeConstants.OF10_VERSION_ID, 44L);
95 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
96 44L, MeterBandExperimenterCase.class);
97 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
101 public void testCreateVendorMessageDeserializerKey() throws Exception {
102 ExperimenterIdDeserializerKey createdKey;
103 ExperimenterIdDeserializerKey comparationKey;
105 createdKey = ExperimenterDeserializerKeyFactory.createVendorMessageDeserializerKey(
106 EncodeConstants.OF10_VERSION_ID, 43L);
107 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
108 43L, ExperimenterDataOfChoice.class);
109 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
113 public void testCreateMultipartReplyVendorMessageDeserializerKey() throws Exception {
114 ExperimenterIdDeserializerKey createdKey;
115 ExperimenterIdDeserializerKey comparationKey;
117 createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyVendorMessageDeserializerKey(
118 EncodeConstants.OF10_VERSION_ID, 43L);
119 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
120 43L, ExperimenterDataOfChoice.class);
121 Assert.assertEquals("Wrong key created", comparationKey, createdKey);