Mass replace CRLF->LF
[openflowjava.git] / util / src / test / java / org / opendaylight / openflowjava / util / ExperimenterDeserializerKeyFactoryTest.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowjava.util;
10
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
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.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
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;
21
22 /**
23  * @author michal.polkorab
24  *
25  */
26 public class ExperimenterDeserializerKeyFactoryTest {
27
28     /**
29      * Test ExperimenterDeserializerKeyFactory key creation
30      */
31     @Test
32     public void test() {
33         ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory
34                 .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
35         ExperimenterIdDeserializerKey comparationKey =
36                 new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
37         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
38         createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(
39                 EncodeConstants.OF10_VERSION_ID, null);
40         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
41                 null, ErrorMessage.class);
42         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
43         createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
44                 EncodeConstants.OF10_VERSION_ID, 43L);
45         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
46                 43L, ExperimenterMessage.class);
47         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
48         createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
49                 EncodeConstants.OF10_VERSION_ID, null);
50         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
51                 null, ExperimenterMessage.class);
52         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
53         createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
54                 EncodeConstants.OF10_VERSION_ID, 44L);
55         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
56                 44L, MeterBandExperimenterCase.class);
57         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
58         createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
59                 EncodeConstants.OF10_VERSION_ID, null);
60         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
61                 null, MeterBandExperimenterCase.class);
62         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
63         createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
64                 EncodeConstants.OF10_VERSION_ID, 45L);
65         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
66                 45L, MultipartReplyExperimenterCase.class);
67         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
68         createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
69                 EncodeConstants.OF10_VERSION_ID, null);
70         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
71                 null, MultipartReplyExperimenterCase.class);
72         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
73         createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
74                 EncodeConstants.OF10_VERSION_ID, null);
75         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
76                 null, TableFeatureProperties.class);
77         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
78         createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
79                 EncodeConstants.OF10_VERSION_ID, null);
80         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
81                 null, TableFeatureProperties.class);
82         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
83         createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
84                 EncodeConstants.OF10_VERSION_ID, null);
85         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
86                 null, QueueProperty.class);
87         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
88         createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
89                 EncodeConstants.OF10_VERSION_ID, null);
90         comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
91                 null, QueueProperty.class);
92         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
93     }
94 }