Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / protocol / deserialization / multipart / AbstractMultipartDeserializerTest.java
1 /*
2  * Copyright (c) 2017 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 package org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart;
9
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
12 import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
13 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
14 import org.opendaylight.openflowplugin.impl.protocol.deserialization.AbstractDeserializerTest;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
16
17 public abstract class AbstractMultipartDeserializerTest  extends AbstractDeserializerTest {
18
19     private OFDeserializer<MultipartReplyBody> deserializer;
20
21     @Override
22     protected void init() {
23         deserializer = getRegistry().getDeserializer(
24                 new MessageCodeKey(EncodeConstants.OF_VERSION_1_3, getType(), MultipartReplyBody.class));
25     }
26
27     protected MultipartReplyBody deserializeMultipart(final ByteBuf message) {
28         return deserializer.deserialize(message);
29     }
30
31     protected abstract int getType();
32 }