Remove deprecated Interfaces/Methods 05/51105/3
authorClaudio D. Gasparini <cgaspari@cisco.com>
Tue, 17 Jan 2017 10:59:21 +0000 (11:59 +0100)
committerMilos Fabian <milos.fabian@pantheon.tech>
Sat, 28 Jan 2017 15:01:22 +0000 (15:01 +0000)
Remove deprecated Interfaces/Methods

Change-Id: Ia543c2e6afd09c753c0a662d4811cb7a4ce1fcc5
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LocRIBListener.java [deleted file]
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorSpecificTlvParser.java [deleted file]
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java
util/src/main/java/org/opendaylight/protocol/util/ByteArray.java
util/src/main/java/org/opendaylight/protocol/util/ByteBufWriteUtil.java
util/src/test/java/org/opendaylight/protocol/util/ByteArrayTest.java
util/src/test/java/org/opendaylight/protocol/util/ByteBufWriteUtilTest.java

diff --git a/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LocRIBListener.java b/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LocRIBListener.java
deleted file mode 100644 (file)
index 6862ab2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.bgpcep.bgp.topology.provider;
-
-import java.util.EventListener;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * @deprecated This interface is slated for removal in a future release.
- */
-@Deprecated
-public interface LocRIBListener extends EventListener {
-    /**
-     * @param trans Modification transaction. The implementation must explicitly commit it if it wishes to have its
-     *        modifications propagated. The transaction is not shared with any other entity and will be cleaned up by
-     *        the caller if it is not committed before this method returns.
-     * @param event Data change event
-     */
-    void onLocRIBChange(ReadWriteTransaction trans, AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event);
-}
diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorSpecificTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorSpecificTlvParser.java
deleted file mode 100644 (file)
index 80476ff..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.parser.tlv;
-
-import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt;
-
-import com.google.common.base.Preconditions;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.protocol.pcep.spi.TlvUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vs.tlv.VsTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vs.tlv.VsTlvBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vs.tlv.vs.tlv.VendorPayload;
-
-/**
- * Vs-tlv model has been deprecated, vendor-information-tlv should be used instead.
- * Therefore parsers/serializers wont be need it any more and this class is slated
- * for removal in a future release.
- */
-@Deprecated
-public abstract class AbstractVendorSpecificTlvParser implements TlvParser, TlvSerializer {
-
-    public static final int TYPE = 27;
-
-    @Override
-    public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
-        Preconditions.checkArgument(tlv instanceof VsTlv, "Vendor Specific Tlv is mandatory.");
-        final VsTlv vsTlv = (VsTlv) tlv;
-        final ByteBuf body = Unpooled.buffer();
-        if (vsTlv.getEnterpriseNumber().getValue() == getEnterpriseNumber()) {
-            Preconditions.checkArgument(vsTlv.getEnterpriseNumber() != null, "EnterpriseNumber is mandatory.");
-            writeUnsignedInt(vsTlv.getEnterpriseNumber().getValue(), body);
-            serializeVendorPayload(vsTlv.getVendorPayload(), body);
-            TlvUtil.formatTlv(TYPE, body, buffer);
-        }
-    }
-
-    @Override
-    public VsTlv parseTlv(final ByteBuf buffer) throws PCEPDeserializerException {
-        if (buffer == null) {
-            return null;
-        }
-        final VsTlvBuilder vsTlvBuider = new VsTlvBuilder();
-        final long en = buffer.readUnsignedInt();
-        if (en == getEnterpriseNumber()) {
-            vsTlvBuider.setEnterpriseNumber(new EnterpriseNumber(getEnterpriseNumber()));
-            VendorPayload vendorPayload = null;
-            if (buffer.isReadable()) {
-                final ByteBuf payloadBytes = buffer.slice();
-                vendorPayload = parseVendorPayload(payloadBytes);
-                if (vendorPayload != null) {
-                    vsTlvBuider.setVendorPayload(vendorPayload);
-                }
-            }
-        }
-        return vsTlvBuider.build();
-    }
-
-    protected abstract void serializeVendorPayload(final VendorPayload payload, final ByteBuf buffer);
-
-    protected abstract long getEnterpriseNumber();
-
-    protected abstract VendorPayload parseVendorPayload(final ByteBuf payloadBytes) throws PCEPDeserializerException;
-}
index d1adcb58db371c8ab098a3a36bddcea9ff00a304..ded11b61a2b8fd6a4cc1ab080f6412b303d4c868 100644 (file)
@@ -17,7 +17,6 @@ import io.netty.buffer.Unpooled;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
-import org.opendaylight.protocol.pcep.parser.tlv.AbstractVendorSpecificTlvParser;
 import org.opendaylight.protocol.pcep.parser.tlv.NoPathVectorTlvParser;
 import org.opendaylight.protocol.pcep.parser.tlv.OFListTlvParser;
 import org.opendaylight.protocol.pcep.parser.tlv.OrderTlvParser;
@@ -43,10 +42,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.tlvs.VendorInformationTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.tlvs.VendorInformationTlvBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vs.tlv.VsTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vs.tlv.VsTlvBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vs.tlv.vs.tlv.VendorPayload;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public class PCEPTlvParserTest {
 
@@ -56,8 +51,6 @@ public class PCEPTlvParserTest {
     private static final byte[] orderBytes = { 0x00, 0x05, 0x00, 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, 0x00, 0x00,
         0x00, 0x01 };
     private static final byte[] ofListBytes = { 0x00, 0x04, 0x00, 0x04, 0x12, 0x34, 0x56, 0x78 };
-    private static final byte[] vsTlvBytes = { 0x00, 0x1b, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
-        0x05 };
     private static final byte[] VENDOR_INFO_BYTES = {
         0x00, 0x07, 0x00, 0x08,
         /* Enterprise number */
@@ -70,32 +63,6 @@ public class PCEPTlvParserTest {
 
     private static final byte[] PST_TLV_BYTES_UNSUPPORTED = { 0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1 };
 
-    private final AbstractVendorSpecificTlvParser vsParser = new AbstractVendorSpecificTlvParser() {
-
-        @Override
-        protected void serializeVendorPayload(final VendorPayload payload, final ByteBuf buffer) {
-            buffer.writeBytes(new byte[] { 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05 });
-        }
-
-        @Override
-        protected VendorPayload parseVendorPayload(final ByteBuf payloadBytes) throws PCEPDeserializerException {
-            return PCEPTlvParserTest.this.vp;
-        }
-
-        @Override
-        protected long getEnterpriseNumber() {
-            return 9;
-        }
-    };
-
-    private final VendorPayload vp = new VendorPayload() {
-
-        @Override
-        public Class<? extends DataContainer> getImplementedInterface() {
-            return null;
-        }
-    };
-
     @Test
     public void testNoPathVectorTlv() throws PCEPDeserializerException {
         final NoPathVectorTlvParser parser = new NoPathVectorTlvParser();
@@ -155,16 +122,6 @@ public class PCEPTlvParserTest {
         assertNull(parser.parseTlv(null));
     }
 
-    @Test
-    public void testVendorSpecificTlv() throws PCEPDeserializerException {
-        final VsTlv tlv = new VsTlvBuilder().setEnterpriseNumber(new EnterpriseNumber(9L)).setVendorPayload(this.vp).build();
-        assertEquals(tlv, this.vsParser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(vsTlvBytes, 4))));
-        final ByteBuf buff = Unpooled.buffer();
-        this.vsParser.serializeTlv(tlv, buff);
-        assertArrayEquals(vsTlvBytes, ByteArray.getAllBytes(buff));
-        assertNull(this.vsParser.parseTlv(null));
-    }
-
     @Test
     public void testVendorInformationTlv() throws PCEPDeserializerException {
         final TestVendorInformationTlvParser parser = new TestVendorInformationTlvParser();
index aa84f6abe4a4d38690f0654043bf035882cad0c1..03b3ee73196b6e921ef6325aee271543c4ff7e77 100644 (file)
@@ -160,62 +160,6 @@ public final class ByteArray {
         return Arrays.copyOfRange(bytes, count, bytes.length);
     }
 
-    /**
-     * Parse byte to bits, from the leftmost bit.
-     *
-     * @param b byte to be parsed
-     * @return array of booleans with size of 8
-     */
-    @Deprecated
-    public static boolean[] parseBits(final byte b) {
-        final boolean[] bits = new boolean[Byte.SIZE];
-        int j = 0;
-        for (int i = Byte.SIZE - 1; i >= 0; i--) {
-            bits[j] = ((b & (1 << i)) != 0);
-            j++;
-        }
-        return bits;
-    }
-
-    /**
-     * Parses array of bytes to BitSet, from left most bit.
-     *
-     * @param bytes array of bytes to be parsed
-     * @return BitSet with length = bytes.length * Byte.SIZE
-     */
-    @Deprecated
-    public static BitSet bytesToBitSet(final byte[] bytes) {
-        final BitSet bitSet = new BitSet(bytes.length * Byte.SIZE);
-        for (int bytesIter = 0; bytesIter < bytes.length; bytesIter++) {
-            final int offset = bytesIter * Byte.SIZE;
-            for (int byteIter = Byte.SIZE - 1; byteIter >= 0; byteIter--) {
-                bitSet.set(offset + (Byte.SIZE - byteIter - 1), (bytes[bytesIter] & 1 << (byteIter)) != 0);
-            }
-        }
-        return bitSet;
-    }
-
-    /**
-     * Parses BitSet to bytes, from most left bit.
-     *
-     * @param bitSet BitSet to be parsed
-     * @param returnedLength Length of returned array. Overlapping flags are truncated.
-     * @return parsed array of bytes with length of bitSet.length / Byte.SIZE
-     */
-    @Deprecated
-    public static byte[] bitSetToBytes(final BitSet bitSet, final int returnedLength) {
-        final byte[] bytes = new byte[returnedLength];
-
-        for (int bytesIter = 0; bytesIter < bytes.length; bytesIter++) {
-            final int offset = bytesIter * Byte.SIZE;
-
-            for (int byteIter = Byte.SIZE - 1; byteIter >= 0; byteIter--) {
-                bytes[bytesIter] |= (bitSet.get(offset + (Byte.SIZE - byteIter - 1)) ? 1 << byteIter : 0);
-            }
-        }
-        return bytes;
-    }
-
     /**
      * Parses file to array of bytes
      *
index d7337091e26e020e038502a94e4e023286129c26..b113e8bcf82e0eefcc08ffc8a946b59f8ce5622c 100644 (file)
@@ -306,26 +306,4 @@ public final class ByteBufWriteUtil {
             output.writeZero(FLOAT32_BYTES_LENGTH);
         }
     }
-
-    /**
-     * Writes BitSet's bits if not null, otherwise writes zeros to the
-     * <code>output</code> ByteBuf. ByteBuf's writerIndex is increased by
-     * specified length.
-     *
-     * @param bitSet
-     *            BitSet values to be written to the output, starting from left most bit.
-     * @param outputLength
-     *            Number of bytes to be written, must be greater than 0.
-     * @param output
-     *            ByteBuf, where bitSet or zeros are written.
-     */
-    public static void writeBitSet(final BitSet bitSet, final int outputLength, final ByteBuf output) {
-        Preconditions.checkArgument(outputLength > 0);
-        if (bitSet != null) {
-            output.writeBytes(ByteArray.bitSetToBytes(bitSet, outputLength));
-        } else {
-            output.writeZero(outputLength);
-        }
-    }
-
 }
index 4d017905f8f60089a3f92cc8568257edb7c0d7a0..08e2f00712e47c1abbcd562be0c45241bbc63ac5 100644 (file)
@@ -117,20 +117,6 @@ public class ByteArrayTest {
         ByteArray.cutBytes(this.before, 0);
     }
 
-    @Test
-    public void testParseBits() {
-        final byte b = (byte) -76; // 1011 0100
-        final boolean[] after = ByteArray.parseBits(b);
-        assertTrue(after[0]);
-        assertFalse(after[1]);
-        assertTrue(after[2]);
-        assertTrue(after[3]);
-        assertFalse(after[4]);
-        assertTrue(after[5]);
-        assertFalse(after[6]);
-        assertFalse(after[7]);
-    }
-
     private final byte[] inBytes = { (byte) 0x03, (byte) 0xFF, (byte) 0x01, (byte) 0x80 };
     final BitSet inBitSet = new BitSet();
 
@@ -149,25 +135,6 @@ public class ByteArrayTest {
         this.inBitSet.set(24);
     }
 
-    @Test
-    public void testBytesToBitSetFunction() {
-        final BitSet iputBitSet = ByteArray.bytesToBitSet(this.inBytes);
-
-        assertEquals(this.inBitSet, iputBitSet);
-    }
-
-    @Test
-    public void testBitSetToBytesFunction() {
-        byte[] resultBytes = ByteArray.bitSetToBytes(this.inBitSet, this.inBytes.length);
-        assertArrayEquals(this.inBytes, resultBytes);
-
-        resultBytes = ByteArray.bitSetToBytes(this.inBitSet, this.inBytes.length - 1);
-        assertArrayEquals(Arrays.copyOf(this.inBytes, this.inBytes.length - 1), resultBytes);
-
-        resultBytes = ByteArray.bitSetToBytes(this.inBitSet, this.inBytes.length + 1);
-        assertArrayEquals(Arrays.copyOf(this.inBytes, this.inBytes.length + 1), resultBytes);
-    }
-
     @Test
     public void testFileToBytes() throws IOException {
         final String FILE_TO_TEST = "src/test/resources/PCEStatefulCapabilityTlv1.bin";
index e6e9b13c9ea570c21808a8c02f8df9283185b9b0..f8170ddf0bc3dd5be0686e165af4c192de0efd60 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.protocol.util;
 
 import static org.junit.Assert.assertArrayEquals;
-import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeBitSet;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeBoolean;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeInt;
@@ -30,7 +29,6 @@ import io.netty.buffer.Unpooled;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.math.BigInteger;
-import java.util.BitSet;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
@@ -222,20 +220,6 @@ public class ByteBufWriteUtilTest {
         assertArrayEquals(FOUR_BYTE_ZEROS, output.array());
     }
 
-    @Test
-    public void testWriteBitSet() {
-        final byte[] result = { 1 };
-        final ByteBuf output = Unpooled.buffer(1);
-        final BitSet bitSet = new BitSet(8);
-        bitSet.set(7);
-        writeBitSet(bitSet, 1, output);
-        assertArrayEquals(result, output.array());
-
-        output.clear();
-        writeBitSet(null, 1, output);
-        assertArrayEquals(ONE_BYTE_ZERO, output.array());
-    }
-
     @Test(expected=UnsupportedOperationException.class)
     public void testPrivateConstructor() throws Throwable {
         final Constructor<ByteBufWriteUtil> c = ByteBufWriteUtil.class.getDeclaredConstructor();