Change BatchedModifications to extend VersionedExternalizableMessage
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / CompositeModificationByteStringPayloadTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.cluster.datastore;
10
11 import static junit.framework.Assert.assertTrue;
12 import org.apache.commons.lang.SerializationUtils;
13 import org.junit.Test;
14 import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
15 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
16 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.CompositeModificationByteStringPayload;
17 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
18 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
19
20 @Deprecated
21 public class CompositeModificationByteStringPayloadTest {
22
23     @Test
24     public void testSerialization(){
25         WriteModification writeModification =
26                 new WriteModification(TestModel.TEST_PATH, ImmutableNodes
27                         .containerNode(TestModel.TEST_QNAME));
28
29         MutableCompositeModification compositeModification =
30                 new MutableCompositeModification(DataStoreVersions.HELIUM_2_VERSION);
31
32         compositeModification.addModification(writeModification);
33
34         CompositeModificationByteStringPayload compositeModificationByteStringPayload
35                 = new CompositeModificationByteStringPayload(compositeModification.toSerializable());
36
37         byte[] bytes = SerializationUtils.serialize(compositeModificationByteStringPayload);
38
39         Object deserialize = SerializationUtils.deserialize(bytes);
40
41         assertTrue(deserialize instanceof CompositeModificationByteStringPayload);
42
43     }
44 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.