Remove DataChangeListener protobuff messages
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / protobuff / messages / registration / ListenerRegistrationMessagesTest.java
1 /*
2  *
3  *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  *  This program and the accompanying materials are made available under the
6  *  terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  *  and is available at http://www.eclipse.org/legal/epl-v10.html
8  *
9  */
10
11 package org.opendaylight.controller.protobuff.messages.registration;
12
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
16
17 /**
18  * This test case is present to ensure that if others have used proper version of protocol buffer
19  * for the ListenerRegistration.proto messages
20  *
21  * If a different version of protocol buffer and there is change in serializaiton format
22  * this test would break as we are comparing with protocol buffer 2.5 generated
23  * serialized data.
24  *
25  * @author: syedbahm
26  *
27  */
28
29 public class ListenerRegistrationMessagesTest extends AbstractMessagesTest {
30
31   @Override
32   @Test
33   public void verifySerialization() throws Exception {
34     String testListenerRegistrationPath =
35         "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test?revision=2014-04-15)family";
36     ListenerRegistrationMessages.RegisterChangeListenerReply.Builder builder =
37         ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder();
38     builder.setListenerRegistrationPath(testListenerRegistrationPath);
39
40     writeToFile(builder);
41
42     ListenerRegistrationMessages.RegisterChangeListenerReply rclrNew =
43         (ListenerRegistrationMessages.RegisterChangeListenerReply) readFromFile(ListenerRegistrationMessages.RegisterChangeListenerReply.PARSER);
44     Assert.assertEquals(testListenerRegistrationPath,
45         rclrNew.getListenerRegistrationPath());
46
47     ListenerRegistrationMessages.RegisterChangeListenerReply rclrOriginal =
48         (ListenerRegistrationMessages.RegisterChangeListenerReply) readFromTestDataFile(ListenerRegistrationMessages.RegisterChangeListenerReply.PARSER);
49     Assert.assertEquals(rclrOriginal.getListenerRegistrationPath(),
50         rclrNew.getListenerRegistrationPath());
51
52   }
53
54   @Override
55   public String getTestFileName() {
56     return ListenerRegistrationMessages.class.getSimpleName();
57   }
58 }

©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.