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 * @author michal.polkorab
25 public class ExperimenterDeserializerKeyFactoryTest {
28 public void testCreateExperimenterErrorDeserializerKey() throws Exception {
29 ExperimenterIdDeserializerKey createdKey;
30 ExperimenterIdDeserializerKey comparationKey;
32 createdKey = ExperimenterDeserializerKeyFactory
33 .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
34 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
35 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
39 public void testCreateExperimenterMessageDeserializerKey() throws Exception {
40 ExperimenterIdDeserializerKey createdKey;
41 ExperimenterIdDeserializerKey comparationKey;
43 createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
44 EncodeConstants.OF10_VERSION_ID, 43L, 1L);
45 comparationKey = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
46 43L, 1L, ExperimenterDataOfChoice.class);
47 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
51 public void testCreateMultipartReplyMessageDeserializerKey() throws Exception {
52 ExperimenterIdDeserializerKey createdKey;
53 ExperimenterIdDeserializerKey comparationKey;
55 createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
56 EncodeConstants.OF10_VERSION_ID, 45L, 1L);
57 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
58 45L, ExperimenterDataOfChoice.class);
59 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
63 public void testCreateMultipartReplyTFDeserializerKey() throws Exception {
64 ExperimenterIdDeserializerKey createdKey;
65 ExperimenterIdDeserializerKey comparationKey;
67 createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
68 EncodeConstants.OF10_VERSION_ID, 46L);
69 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
70 46L, TableFeatureProperties.class);
71 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
75 public void testCreateQueuePropertyDeserializerKey() throws Exception {
76 ExperimenterIdDeserializerKey createdKey;
77 ExperimenterIdDeserializerKey comparationKey;
79 createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
80 EncodeConstants.OF10_VERSION_ID, 47L);
81 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
82 47L, QueueProperty.class);
83 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
87 public void testCreateMeterBandDeserializerKey() throws Exception {
88 ExperimenterIdDeserializerKey createdKey;
89 ExperimenterIdDeserializerKey comparationKey;
91 createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
92 EncodeConstants.OF10_VERSION_ID, 44L);
93 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
94 44L, MeterBandExperimenterCase.class);
95 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
99 public void testCreateVendorMessageDeserializerKey() throws Exception {
100 ExperimenterIdDeserializerKey createdKey;
101 ExperimenterIdDeserializerKey comparationKey;
103 createdKey = ExperimenterDeserializerKeyFactory.createVendorMessageDeserializerKey(
104 EncodeConstants.OF10_VERSION_ID, 43L);
105 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
106 43L, ExperimenterDataOfChoice.class);
107 Assert.assertEquals("Wrong key created", comparationKey, createdKey);
111 public void testCreateMultipartReplyVendorMessageDeserializerKey() throws Exception {
112 ExperimenterIdDeserializerKey createdKey;
113 ExperimenterIdDeserializerKey comparationKey;
115 createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyVendorMessageDeserializerKey(
116 EncodeConstants.OF10_VERSION_ID, 43L);
117 comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
118 43L, ExperimenterDataOfChoice.class);
119 Assert.assertEquals("Wrong key created", comparationKey, createdKey);