X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fmessaging%2FBytesMessage.java;fp=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fmessaging%2FBytesMessage.java;h=1805bed8371e34f690cae21707523715c603807a;hb=3582bb6dbc506b0c79dd3e4b4f791f4e17cd3103;hp=0000000000000000000000000000000000000000;hpb=90ba78e0575edaa56610eeed936c03261839f2d2;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/BytesMessage.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/BytesMessage.java new file mode 100644 index 0000000000..1805bed837 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/BytesMessage.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2017 Inocybe Technologies 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.controller.cluster.messaging; + +import java.io.Serializable; +import java.util.Arrays; + +/** + * Serializable message that stores a byte[]. + * + * @author Thomas Pantelis + */ +public class BytesMessage implements Serializable { + private static final long serialVersionUID = 1L; + + private final byte[] bytes; + + public BytesMessage(byte[] bytes) { + this.bytes = Arrays.copyOf(bytes, bytes.length); + } + + @Override + public int hashCode() { + return Arrays.hashCode(bytes); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + BytesMessage other = (BytesMessage) obj; + return Arrays.equals(bytes, other.bytes); + } + + @Override + public String toString() { + return "BytesMessage [bytes=" + Arrays.toString(bytes) + "]"; + } +}