Mass replace CRLF->LF
[openflowjava.git] / util / src / test / java / org / opendaylight / openflowjava / util / ExperimenterSerializerKeyFactoryTest.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.ExperimenterIdSerializerKey;
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
19
20 /**
21  * @author michal.polkorab
22  *
23  */
24 public class ExperimenterSerializerKeyFactoryTest {
25
26     /**
27      * Test ExperimenterSerializerKeyFactory key creation
28      */
29     @Test
30     public void test() {
31         ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory
32                 .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
33         ExperimenterIdSerializerKey<?> comparationKey =
34                 new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);
35         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
36         createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(
37                 EncodeConstants.OF10_VERSION_ID, null);
38         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
39                 null, ExperimenterInput.class);
40         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
41         createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
42                 EncodeConstants.OF10_VERSION_ID, 43L);
43         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
44                 43L, MeterBandExperimenterCase.class);
45         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
46         createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
47                 EncodeConstants.OF10_VERSION_ID, null);
48         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
49                 null, MeterBandExperimenterCase.class);
50         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
51         createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
52                 EncodeConstants.OF10_VERSION_ID, 44L);
53         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
54                 44L, MultipartRequestExperimenterCase.class);
55         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
56         createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
57                 EncodeConstants.OF10_VERSION_ID, null);
58         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
59                 null, MultipartRequestExperimenterCase.class);
60         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
61         createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
62                 EncodeConstants.OF10_VERSION_ID, 45L);
63         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
64                 45L, TableFeatureProperties.class);
65         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
66         createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
67                 EncodeConstants.OF10_VERSION_ID, null);
68         comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
69                 null, TableFeatureProperties.class);
70         Assert.assertEquals("Wrong key created", comparationKey, createdKey);
71     }
72 }