X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-protocolbuffer-encoding%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotobuff%2Fmessages%2Ftransaction%2FShardTransactionMessagesTest.java;fp=opendaylight%2Fmd-sal%2Fsal-protocolbuffer-encoding%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotobuff%2Fmessages%2Ftransaction%2FShardTransactionMessagesTest.java;h=0000000000000000000000000000000000000000;hb=6b9c0bb57b65343df31fd68d178821a22afd0fe2;hp=6b538dab0da711250ab867e00a7ca42f80d45395;hpb=cc6c063be5f143cd601208ef26604d90a25bd1a5;p=controller.git diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java deleted file mode 100644 index 6b538dab0d..0000000000 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java +++ /dev/null @@ -1,85 +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.controller.protobuff.messages.transaction; - -import org.junit.Assert; -import org.junit.Test; -import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.yangtools.yang.common.QName; - -/** - * This test case is present to ensure that if others have used proper version of protocol buffer - * for the ShardTransaction.proto messages - * - * If a different version of protocol buffer and there is change in serializaiton format - * this test would break as we are comparing with protocol buffer 2.5 generated - * serialized data. - * - * @author: syedbahm - * - */ - - -public class ShardTransactionMessagesTest extends AbstractMessagesTest { - - private final String namespace = "urn:protobuff", revision = "2014-07-31", - localName = "test"; - - @Test - public void verifySerialization() throws Exception { - NormalizedNodeMessages.InstanceIdentifier.Builder instanceIdentifierBuilder = - NormalizedNodeMessages.InstanceIdentifier.newBuilder(); - NormalizedNodeMessages.PathArgument.Builder pathArgument = - NormalizedNodeMessages.PathArgument.newBuilder(); - pathArgument.setNodeType(NormalizedNodeMessages.QName.newBuilder() - .setValue(QName.create(namespace, revision, localName).toString()) - .build()); - pathArgument.setValue("test"); - instanceIdentifierBuilder.addArguments(pathArgument.build()); - ShardTransactionMessages.ReadData.Builder builder = - ShardTransactionMessages.ReadData.newBuilder(); - NormalizedNodeMessages.InstanceIdentifier expectedOne = - instanceIdentifierBuilder.build(); - builder.setInstanceIdentifierPathArguments(expectedOne); - - writeToFile((com.google.protobuf.GeneratedMessage.Builder) builder); - - // Here we will read the same and check we got back what we had saved - ShardTransactionMessages.ReadData readDataNew = - (ShardTransactionMessages.ReadData) readFromFile(ShardTransactionMessages.ReadData.PARSER); - - - Assert.assertEquals(expectedOne.getArgumentsCount(), readDataNew - .getInstanceIdentifierPathArguments().getArgumentsCount()); - Assert.assertEquals(expectedOne.getArguments(0), readDataNew - .getInstanceIdentifierPathArguments().getArguments(0)); - - - // the following will compare with the version we had shipped - ShardTransactionMessages.ReadData readDataOriginal = - (ShardTransactionMessages.ReadData) readFromTestDataFile(ShardTransactionMessages.ReadData.PARSER); - - - Assert.assertEquals(readDataNew.getInstanceIdentifierPathArguments() - .getArguments(0), readDataOriginal.getInstanceIdentifierPathArguments() - .getArguments(0)); - - } - - @Override - public String getTestFileName() { - return ShardTransactionMessagesTest.class.getSimpleName(); - } - - - -}