2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.cluster.datastore;
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;
21 public class CompositeModificationByteStringPayloadTest {
24 public void testSerialization(){
25 WriteModification writeModification =
26 new WriteModification(TestModel.TEST_PATH, ImmutableNodes
27 .containerNode(TestModel.TEST_QNAME));
29 MutableCompositeModification compositeModification =
30 new MutableCompositeModification(DataStoreVersions.HELIUM_2_VERSION);
32 compositeModification.addModification(writeModification);
34 CompositeModificationByteStringPayload compositeModificationByteStringPayload
35 = new CompositeModificationByteStringPayload(compositeModification.toSerializable());
37 byte[] bytes = SerializationUtils.serialize(compositeModificationByteStringPayload);
39 Object deserialize = SerializationUtils.deserialize(bytes);
41 assertTrue(deserialize instanceof CompositeModificationByteStringPayload);